#include <QString>
#include <QComboBox>
#include <QEvent>
+#include <QAction>
+#include <QApplication>
+#include <QClipboard>
#include <memory>
#include <string>
//TODO_END
connect(myTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelectionTypeChanged()));
+ myCopyAction = new QAction(QIcon(":pictures/copy.png"), tr("Copy"), this);
+ myCopyAction->setShortcut(QKeySequence::Copy);
+ myCopyAction->setEnabled(false);
+ connect(myCopyAction, SIGNAL(triggered(bool)), SLOT(onCopyItem()));
+ myListControl->addAction(myCopyAction);
+ myListControl->setContextMenuPolicy(Qt::ActionsContextMenu);
+ connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
+
activateSelection(true);
}
myListControl->addItem(aAttr->namingName().c_str());
}
}
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::onCopyItem()
+{
+ QList<QListWidgetItem*> aItems = myListControl->selectedItems();
+ QString aRes;
+ foreach(QListWidgetItem* aItem, aItems) {
+ if (!aRes.isEmpty())
+ aRes += "\n";
+ aRes += aItem->text();
+ }
+ if (!aRes.isEmpty()) {
+ QClipboard *clipboard = QApplication::clipboard();
+ clipboard->setText(aRes);
+ }
+}
+
+//********************************************************************
+void ModuleBase_WidgetMultiSelector::onListSelection()
+{
+ QList<QListWidgetItem*> aItems = myListControl->selectedItems();
+ myCopyAction->setEnabled(!aItems.isEmpty());
+}
+
class QListWidget;
class QComboBox;
class ModuleBase_IWorkshop;
+class QAction;
class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_ModelWidget
{
void onSelectionTypeChanged();
void onSelectionChanged();
+protected slots:
+ void onCopyItem();
+ void onListSelection();
+
protected:
void filterShapes(const NCollection_List<TopoDS_Shape>& theShapesToFilter,
NCollection_List<TopoDS_Shape>& theResult);
typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
QList<GeomSelection> mySelection;
+
+ QAction* myCopyAction;
};
#endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */
<file>pictures/undo.png</file>
<file>pictures/rebuild.png</file>
<file>pictures/preferences.png</file>
+ <file>pictures/copy.png</file>
<file>pictures/params_folder.png</file>
<file>pictures/constr_folder.png</file>