AMScanViewPlotToolsButtonView::AMScanViewPlotToolsButtonView(AMScanViewPlotTools *tools, QWidget *parent) : QWidget(parent) { // Initialize member variables. tools_ = 0; buttons_ = new QButtonGroup(this); buttons_->setExclusive(false); // Create and set layouts. layout_ = new QHBoxLayout(); layout_->setMargin(0); layout_->setSpacing(0); setLayout(layout_); // Make connections. connect( buttons_, SIGNAL(buttonClicked(int)), this, SLOT(onToolButtonClicked(int)) ); // Current settings. setTools(tools); }
void AMScanViewPlotTools::removeTool(MPlotAbstractTool *tool) { if (tools_.contains(tool)) { // Remove the tool from selection, if it's selected. if (selectedTools_.contains(tool)) removeSelectedTool(tool); // We can preserve the current selection. QList<MPlotAbstractTool*> selection = selectedTools_; // Remove tool. QList<MPlotAbstractTool*> tools = tools_; tools.removeOne(tool); // Set new list of tools. setTools(tools); // Restore selection. setSelectedTools(selection); } }
AMScanViewPlotTools::AMScanViewPlotTools(const QList<MPlotAbstractTool *> &tools, bool exclusiveSelection, QObject *parent) : QObject(parent) { // Initialize member variables. exclusiveSelection_ = false; // Current settings. setTools(tools); setExclusiveSelectionEnabled(exclusiveSelection); }
void AMScanViewPlotTools::addTool(MPlotAbstractTool *newTool) { if (!tools_.contains(newTool)) { // We can preserve the selected tools. QList<MPlotAbstractTool*> selection = selectedTools_; // Add new tool. QList<MPlotAbstractTool*> tools = tools_; tools << newTool; setTools(tools); // Restore selection. setSelectedTools(selection); } }
int WidgetAnnotTools::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 7) qt_static_metacall(this, _c, _id, _a); _id -= 7; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QStringList*>(_v) = tools(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setTools(*reinterpret_cast< QStringList*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
void AMScanViewPlotTools::clearTools() { setTools(QList<MPlotAbstractTool*>()); }