#include <QAction>
#include <QApplication>
#include <QClipboard>
-#include <QListWidget>
#include <QWidget>
#ifndef WIN32
const int ATTRIBUTE_SELECTION_INDEX_ROLE = Qt::UserRole + 1;
-/**
-* Customization of a List Widget to make it to be placed on full width of container
-*/
-class CustomListWidget : public QListWidget
-{
-public:
- /// Constructor
- /// \param theParent a parent widget
- CustomListWidget(QWidget* theParent)
- : QListWidget(theParent)
- {
- }
-
- /// Redefinition of virtual method
- virtual QSize sizeHint() const
- {
- int aHeight = 2*QFontMetrics(font()).height();
- QSize aSize = QListWidget::sizeHint();
- return QSize(aSize.width(), aHeight);
- }
-
- /// Redefinition of virtual method
- virtual QSize minimumSizeHint() const
- {
- int aHeight = 4/*2*/*QFontMetrics(font()).height();
- QSize aSize = QListWidget::minimumSizeHint();
- return QSize(aSize.width(), aHeight);
- }
-
-#ifndef WIN32
-// The code is necessary only for Linux because
-//it can not update viewport on widget resize
-protected:
- void resizeEvent(QResizeEvent* theEvent)
- {
- QListWidget::resizeEvent(theEvent);
- QTimer::singleShot(5, viewport(), SLOT(repaint()));
- }
-#endif
-};
-
//********************************************************************
ModuleBase_ListView::ModuleBase_ListView(QWidget* theParent, const QString& theObjectName,
const QString& theToolTip)
myListControl->setContextMenuPolicy(Qt::ActionsContextMenu);
connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
+ connect(myListControl, SIGNAL(activated()), this, SIGNAL(listActivated()));
}
//********************************************************************
#include <QModelIndex>
#include <QObject>
+#include <QListWidget>
#include <set>
class QListWidget;
class QWidget;
+
+/**
+* Customization of a List Widget to make it to be placed on full width of container
+*/
+class CustomListWidget : public QListWidget
+{
+ Q_OBJECT
+public:
+ /// Constructor
+ /// \param theParent a parent widget
+ CustomListWidget(QWidget* theParent)
+ : QListWidget(theParent)
+ {
+ }
+
+ /// Redefinition of virtual method
+ virtual QSize sizeHint() const
+ {
+ int aHeight = 2 * QFontMetrics(font()).height();
+ QSize aSize = QListWidget::sizeHint();
+ return QSize(aSize.width(), aHeight);
+ }
+
+ /// Redefinition of virtual method
+ virtual QSize minimumSizeHint() const
+ {
+ int aHeight = 4/*2*/ * QFontMetrics(font()).height();
+ QSize aSize = QListWidget::minimumSizeHint();
+ return QSize(aSize.width(), aHeight);
+ }
+
+signals:
+ void activated();
+
+protected:
+ virtual void mouseReleaseEvent(QMouseEvent* e) {
+ QListWidget::mouseReleaseEvent(e);
+ emit activated();
+ }
+
+#ifndef WIN32
+ // The code is necessary only for Linux because
+ //it can not update viewport on widget resize
+protected:
+ void resizeEvent(QResizeEvent* theEvent)
+ {
+ QListWidget::resizeEvent(theEvent);
+ QTimer::singleShot(5, viewport(), SLOT(repaint()));
+ }
+#endif
+};
+
+
/**
* \ingroup GUI
* An extension of QListWidget to provide Undo/Redo functionality
/// Slot is called on selection of list of selected items
void onListSelection();
+
signals:
/// Signal about delete action click
void deleteActionClicked();
+ void listActivated();
+
protected:
QListWidget* myListControl; ///< List control
myListView = new ModuleBase_ListView(this, anObjName, aToolTip);
connect(myListView->getControl(), SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
connect(myListView, SIGNAL(deleteActionClicked()), SLOT(onDeleteItem()));
+ connect(myListView, SIGNAL(listActivated()), SLOT(onListActivated()));
aMainLay->addWidget(myListView->getControl(), 2, 0, 1, -1);
aMainLay->setRowStretch(2, 1);
{
defaultValues[myFeatureId + attributeID()] = myDefMode;
}
+
+void ModuleBase_WidgetMultiSelector::onListActivated()
+{
+ //focusTo();
+ emitFocusInWidget();
+}
\ No newline at end of file
/// Slot is called on selection of list of selected items
void onListSelection();
+ void onListActivated();
+
protected:
/// Returns true if the event is processed. The default implementation is empty, returns false.
virtual bool processDelete();
#endif
ModuleBase_ModelWidget* aFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this,
aFocusWidget);
- if (aFocusMWidget)
- aFocusMWidget->setHighlighted(false);
+ //if (aFocusMWidget)
+ // aFocusMWidget->setHighlighted(false);
QWidget* aNewFocusWidget = 0;
if (aFocusWidget) {
ModuleBase_ModelWidget* aNewFocusMWidget = ModuleBase_ModelWidget::findModelWidget(this,
aNewFocusWidget);
- if (aNewFocusMWidget)
+ if (aNewFocusMWidget) {
+ if (aFocusMWidget) {
+ aFocusMWidget->setHighlighted(false);
+ }
aNewFocusMWidget->emitFocusInWidget();
- isChangedFocus = true;
+ isChangedFocus = true;
+ }
}
return isChangedFocus;
}