//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void PdmUiTreeViewEditor::updateContextMenuSignals() { if (!m_treeView) return; if (m_useDefaultContextMenu) { m_treeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_treeView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint))); } else { m_treeView->setContextMenuPolicy(Qt::DefaultContextMenu); disconnect(m_treeView, 0, this, 0); } }
Osg3dView::Osg3dView(QWidget *parent) : QOpenGLWidget(parent) , m_viewingCore(new ViewingCore) , m_mouseMode(MM_ORBIT) , m_mouseIsPressed(false) { setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customMenuRequested(QPoint))); #if 0 // This would be interesting to have Perhaps it belongs in OsgForm // Alas, it would be hard to design in qtdesigner QToolBar *tb = new QToolBar(this); tb->addAction("Hello"); tb->addAction("goodbye"); #endif buildPopupMenu(); // Construct the embedded graphics window m_osgGraphicsWindow = new osgViewer::GraphicsWindowEmbedded(0,0,width(),height()); getCamera()->setGraphicsContext(m_osgGraphicsWindow); // Set up the camera getCamera()->setViewport(new osg::Viewport(0,0,width(),height())); getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width())/static_cast<double>(height()), 1.0f, 10000.0f); // By default draw everthing that has even 1 bit set in the nodemask getCamera()->setCullMask( (unsigned)~0 ); getCamera()->setDataVariance(osg::Object::DYNAMIC); // As of July 2010 there wasn't really a good way to multi-thread OSG // under Qt so just set the threading model to be SingleThreaded setThreadingModel(osgViewer::Viewer::SingleThreaded); // draw both sides of polygons setLightingTwoSided(); // this will probably be overwritten but avoids warnings setScene(new osg::Node); update(); }
VanityGenPage::VanityGenPage(QWidget *parent, BitcoinGUI *_gui): QWidget(parent), gui(_gui), walletModel(0), ui(new Ui::VanityGenPage) { ui->setupUi(this); model = new QStandardItemModel(0,3,this); QStringList headerLabels; headerLabels << "Pattern" << "Privkey" << "Chance"; model->setHorizontalHeaderLabels(headerLabels); ui->tableView->setModel(model); ui->tableView->setAlternatingRowColors(true); ui->tableView->verticalHeader()->setVisible(false); ui->tableView->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Stretch); ui->tableView->horizontalHeader()->resizeSection(0,250); ui->tableView->horizontalHeader()->resizeSection(2,150); ui->tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);//MultiSelection); ui->tableView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(tableViewClicked(QItemSelection,QItemSelection))); connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customMenuRequested(QPoint))); ui->tableView->setFocusPolicy(Qt::StrongFocus); ui->tableView->installEventFilter(this); VanityGenKeysChecked = 0; VanityGenHashrate = 0;//"0.0"; VanityGenNThreads = 0; VanityGenMatchCase = 0; //Input field: ui->lineEdit->setValidator(new QRegExpValidator(QRegExp("[S]{1,1}[MNP-Za-k]{1,1}[1-9A-HJ-NP-Za-km-z]{10,10}"), NULL)); ui->lineEdit->setMaxLength(16); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(changeAllowedText())); connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(addPatternClicked())); checkAllowedText(0); //"Add Pattern" - Buttton: connect(ui->buttonPattern, SIGNAL(clicked()), this, SLOT(addPatternClicked())); int nThreads = boost::thread::hardware_concurrency(); int nUseThreads = GetArg("-genproclimit", -1); if (nUseThreads < 0) nUseThreads = nThreads; ui->horizontalSlider->setMaximum(nUseThreads); ui->checkBoxAutoImport->setEnabled(false); ui->buttonImport->setEnabled(false); ui->buttonDelete->setEnabled(false); connect(ui->checkBoxMatchCase, SIGNAL(clicked(bool)), this, SLOT(changeMatchCase(bool))); connect(ui->buttonDelete, SIGNAL(clicked(bool)),this, SLOT(deleteRows())); connect(ui->buttonImport, SIGNAL(clicked(bool)), this, SLOT(importIntoWallet())); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(updateLabelNrThreads(int))); connect(ui->horizontalSlider, SIGNAL(sliderReleased()), this, SLOT(saveFile())); connect(ui->checkBoxAutoImport, SIGNAL(released()), this, SLOT(saveFile())); connect(ui->checkBoxShowPrivKeys, SIGNAL(released()), this, SLOT(saveFile())); connect(ui->buttonStart,SIGNAL(clicked()), this, SLOT(startThread())); connect(ui->buttonUnlock,SIGNAL(clicked()), this, SLOT(unlockWallet())); copyAddressAction = new QAction("Copy Address", this); copyPrivateKeyAction = new QAction("Copy PrivateKey", this); importIntoWalletAction = new QAction("Import into Wallet", this); deleteAction = new QAction("Delete", this); contextMenu = new QMenu(); contextMenu->addAction(importIntoWalletAction); contextMenu->addSeparator(); contextMenu->addAction(copyAddressAction); contextMenu->addAction(copyPrivateKeyAction); contextMenu->addSeparator(); contextMenu->addAction(deleteAction); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); connect(copyPrivateKeyAction, SIGNAL(triggered()), this, SLOT(copyPrivateKey())); connect(importIntoWalletAction, SIGNAL(triggered()), this, SLOT(importIntoWallet())); connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteEntry())); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(updateVanityGenUI())); timer->start(250); updateUi(); loadFile(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { //:/image/cat.jpg ui->setupUi(this); QString imagepath = ":/new/prefix1/folder.png"; QPixmap image0(imagepath); QPixmap image = image0.scaled(QSize(100,100)); qDebug() << image.size(); QIcon myIcon = QIcon(image); QSplitter *page= new QSplitter(); //customer QList<QVariant> title; title<<"one"<<"two"; QList<ItemObject*> values; GetData(values); data =new ItemModel(Q_NULLPTR); data->setHeaderTitle(title); data->BindingData(values); selections = new QItemSelectionModel(data); table = new QTableView; table->setModel(data); table->setSelectionModel(selections); table->setItemDelegate(new MyTableViewStyleDelegate()); table->horizontalHeader()->setSectionsMovable(true); table->setSelectionBehavior(QAbstractItemView::SelectRows); table->verticalHeader()->setSectionsMovable(true); table->horizontalHeader()->setStretchLastSection(true); // Set StaticContents to enable minimal repaints on resizes. table->viewport()->setAttribute(Qt::WA_StaticContents); table->setContextMenuPolicy(Qt::CustomContextMenu); connect(table, SIGNAL(customContextMenuRequested(QPoint)),SLOT(customMenuRequested(QPoint))); //table->setStyleSheet("QTableView{background-color: rgb(250, 250, 115);" "alternate-background-color: rgb(141, 163, 215);}"); //table->setItemDelegateForColumn(0,new MyLineItemDelegate()); table->setItemDelegateForColumn(0,new CheckBoxDelegate(table)); table->setItemDelegateForColumn(1,new ReadOnlyDelegate()); table->setSelectionBehavior(QAbstractItemView::SelectRows); table->setEditTriggers(QAbstractItemView::NoEditTriggers); table->setIconSize(QSize(1,1)); //header checkbox TableCheckedHeader *m_customHeader = NULL; m_customHeader = new TableCheckedHeader(Qt::Horizontal, this); table->setHorizontalHeader(m_customHeader); connect(m_customHeader, SIGNAL(toggled(bool)), this, SLOT(_headertoggled(bool))); page->addWidget(table); QTreeView *tree = new QTreeView; tree->setModel(data); tree->setSelectionModel(selections); tree->setUniformRowHeights(true); tree->header()->setStretchLastSection(false); tree->viewport()->setAttribute(Qt::WA_StaticContents); // Disable the focus rect to get minimal repaints when scrolling on Mac. tree->setAttribute(Qt::WA_MacShowFocusRect, false); page->addWidget(tree); list = new QListView; //QObject::connect(list,SIGNAL(doubleClicked(QModelIndex),this,SLOT(doubleClicked(QModelIndex)))); list->setModel(data); list->setIconSize(QSize(80,80)); list->setItemDelegate(new MyListItemDelegege()); list->setSelectionModel(selections); list->setSpacing(5); list->setViewMode(QListView::IconMode); list->setDragEnabled(false); list->setSelectionRectVisible(false); //list->setSelectionMode(QAbstractItemView::ExtendedSelection); list->setAlternatingRowColors(false); list->setResizeMode(QListWidget::Adjust); //list->viewport()->setAttribute(Qt::WA_StaticContents); list->setAttribute(Qt::WA_MacShowFocusRect, true); //list->setItemDelegateForColumn(1,new MyLineItemDelegate()); list->setEditTriggers(QAbstractItemView::NoEditTriggers); //menu list->setContextMenuPolicy(Qt::CustomContextMenu); connect(list,SIGNAL(customContextMenuRequested(QPoint)),SLOT(CustomListMenuRequested(QPoint))); page->addWidget(list); this->setCentralWidget(page); }
TelemetrySchedulerGadgetWidget::TelemetrySchedulerGadgetWidget(QWidget *parent) : QWidget(parent) { m_telemetryeditor = new Ui_TelemetryScheduler(); m_telemetryeditor->setupUi(this); // In case GCS is not in expert mode, hide the apply button ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); if(!settings->useExpertMode()) m_telemetryeditor->bnApplySchedule->setVisible(false); schedulerModel = new SchedulerModel(0, 0, this); //0 Rows and 0 Columns telemetryScheduleView = new QFrozenTableViewWithCopyPaste(schedulerModel); telemetryScheduleView->setObjectName(QString::fromUtf8("telemetryScheduleView")); telemetryScheduleView->setAlternatingRowColors(true); telemetryScheduleView->horizontalHeader()->setCascadingSectionResizes(false); telemetryScheduleView->horizontalHeader()->setSectionsMovable(true); // The dummy table exists only to force the other widgets into the correct place. // It is removed and replaced tby the custom copy/paste-enabled table int dummyIndex = m_telemetryeditor->gridLayout->indexOf(m_telemetryeditor->tableWidgetDummy); int row, col, rowSpan, colSpan; m_telemetryeditor->gridLayout->getItemPosition(dummyIndex, &row, &col, &rowSpan, &colSpan); m_telemetryeditor->gridLayout->removeWidget(m_telemetryeditor->tableWidgetDummy); m_telemetryeditor->tableWidgetDummy->setVisible(false); m_telemetryeditor->gridLayout->addWidget(telemetryScheduleView, row, col, rowSpan, colSpan); connect(m_telemetryeditor->hideNotPresent, SIGNAL(clicked(bool)), this, SLOT(onHideNotPresent(bool))); // Sets the fields in the table to spinboxes SpinBoxDelegate *delegate = new SpinBoxDelegate(); telemetryScheduleView->setItemDelegate(delegate); // Connect the before setting any signals connect(m_telemetryeditor->bnSaveTelemetryToFile, SIGNAL(clicked()), this, SLOT(saveTelemetryToFile())); connect(m_telemetryeditor->bnLoadTelemetryFromFile, SIGNAL(clicked()), this, SLOT(loadTelemetryFromFile())); connect(m_telemetryeditor->bnApplySchedule, SIGNAL(clicked()), this, SLOT(applySchedule())); connect(m_telemetryeditor->bnSaveSchedule, SIGNAL(clicked()), this, SLOT(saveSchedule())); connect(m_telemetryeditor->bnAddTelemetryColumn, SIGNAL(clicked()), this, SLOT(addTelemetryColumn())); connect(m_telemetryeditor->bnRemoveTelemetryColumn, SIGNAL(clicked()), this, SLOT(removeTelemetryColumn())); connect(schedulerModel, SIGNAL(itemChanged(QStandardItem *)), this, SLOT(dataModel_itemChanged(QStandardItem *))); connect(telemetryScheduleView->horizontalHeader(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(changeHorizontalHeader(int))); connect(telemetryScheduleView->verticalHeader(), SIGNAL(sectionDoubleClicked(int)), this, SLOT(changeVerticalHeader(int))); connect(telemetryScheduleView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customMenuRequested(QPoint))); telemetryScheduleView->setContextMenuPolicy(Qt::CustomContextMenu); // Generate the list of UAVOs on left side objManager = pm->getObject<UAVObjectManager>(); Q_ASSERT(objManager != NULL); QVector< QVector<UAVDataObject*> > objList = objManager->getDataObjectsVector(); QStringList strList; foreach (QVector<UAVDataObject*> list, objList) { if(!list.first()->isSettings()) { strList.append(list.first()->getName()); connect(list.first(), SIGNAL(presentOnHardwareChanged(UAVDataObject*)), this, SLOT(uavoPresentOnHardwareChanged(UAVDataObject*)), Qt::UniqueConnection); } }