VirtualBox

Changeset 59699 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Feb 16, 2016 11:14:18 AM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: ​​​bugref:8088: Rework session-information window: Implementing selecting and copying information-window data to clipboard for information-view.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationView.cpp

    r59647 r59699  
    2121
    2222# include <QClipboard>
    23 # include <QDebug>
    2423
    2524/* GUI includes: */
     
    3433}
    3534
    36 void UIInformationView::updateData(const QModelIndex & topLeft, const QModelIndex & bottomRight)
     35void UIInformationView::updateData(const QModelIndex &topLeft, const QModelIndex &bottomRight)
    3736{
    3837    update(topLeft);
    3938}
    4039
     40void UIInformationView::keyPressEvent(QKeyEvent *pEvent)
     41{
     42    if (pEvent == QKeySequence::Copy)
     43    {
     44        if (selectionModel())
     45        {
     46            QString strText;
     47            foreach (const QModelIndex &index, selectionModel()->selectedIndexes())
     48            {
     49                UIInformationItem *pItem = dynamic_cast<UIInformationItem*>(itemDelegate(index));
     50                if (pItem)
     51                {
     52                    strText.append(pItem->htmlData());
     53                }
     54            }
     55            QApplication::clipboard()->setText(strText);
     56            pEvent->accept();
     57        }
     58    }
     59}
     60
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationView.h

    r59647 r59699  
    3434
    3535public slots:
    36     void updateData(const QModelIndex & topLeft, const QModelIndex & bottomRight);
     36    /** Handles updating data for the index-range @a topLeft to @a bottomRight. */
     37    void updateData(const QModelIndex &topLeft, const QModelIndex &bottomRight);
    3738
     39protected slots:
     40    /** Handles Qt key-press @a pEvent. */
     41    void keyPressEvent(QKeyEvent *pEvent);
    3842};
    3943
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette