TailView::TailView(QWidget * parent): QAbstractScrollArea(parent), m_document(new YTextDocument), m_isActive(false), m_leftMouseIsDown(false), m_hasUnviewedChanges(false), m_layoutType(AutomaticLayout), m_layoutStrategy(new PartialLayout(this)), m_exactScrollBarController(new ExactScrollBarController(this)), m_approximateScrollBarController(new ApproximateScrollBarController(this)), m_scrollBarStrategy(m_approximateScrollBarController.data()), m_followTail(true), m_documentSearch(new DocumentSearch(m_document.data())) { connect(verticalScrollBar(), SIGNAL(actionTriggered(int)), SLOT(vScrollBarAction(int))); connect(Preferences::instance(), SIGNAL(preferencesChanged()), SLOT(onPreferencesChanged())); QAction * copy = new QAction(tr("&Copy"), this); copy->setShortcut(QKeySequence(QKeySequence::Copy)); connect(copy, SIGNAL(triggered()), SLOT(onCopy())); addAction(copy); QAction * separator = new QAction(this); separator->setSeparator(true); addAction(separator); QAction * selectAll = new QAction(tr("Select &All"), this); selectAll->setShortcut(QKeySequence(QKeySequence::SelectAll)); connect(selectAll, SIGNAL(triggered()), SLOT(onSelectAll())); addAction(selectAll); setContextMenuPolicy(Qt::ActionsContextMenu); }
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); statusLebelL = new QLabel(); statusLabelR = new QLabel(); // setup UI ui.statusBar->addWidget(statusLebelL, 1); ui.statusBar->addWidget(statusLabelR, 0); // setup the docking widgets controlWidget = new ControlWidget(this); // register the menu's "AboutToShow" handlers connect(ui.menuEdit, SIGNAL(aboutToShow()), this, SLOT(onMenuEdit())); // register the menu's action handlers connect(ui.actionNew, SIGNAL(triggered()), this, SLOT(onNew())); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen())); connect(ui.actionSave, SIGNAL(triggered()), this, SLOT(onSave())); connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui.actionSelectAll, SIGNAL(triggered()), this, SLOT(onSelectAll())); connect(ui.actionUndo, SIGNAL(triggered()), this, SLOT(onUndo())); connect(ui.actionCut, SIGNAL(triggered()), this, SLOT(onCut())); connect(ui.actionDeleteEdge, SIGNAL(triggered()), this, SLOT(onDeleteEdge())); connect(ui.actionControlWidget, SIGNAL(triggered()), this, SLOT(onShowControlWidget())); // setup the GL widget glWidget = new GLWidget(this); setCentralWidget(glWidget); // setup the event filter glWidget->installEventFilter(this); controlWidget->installEventFilter(this); }
///////// tid filters void FilterTid::setupModel () { if (!m_model) m_model = new QStandardItemModel; m_ui->view->setModel(m_model); m_ui->view->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(m_ui->view, SIGNAL(clicked(QModelIndex)), this, SLOT(onClicked(QModelIndex))); connect(m_ui->allButton, SIGNAL(clicked()), this, SLOT(onSelectAll())); connect(m_ui->noneButton, SIGNAL(clicked()), this, SLOT(onSelectNone())); }
void FilterFileLine::initUI () { m_ui->setupUi(this); connect(m_ui->cutParentSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onCutParentValueChanged(int))); connect(m_ui->collapseChildsButton, SIGNAL(clicked()), this, SLOT(onCollapseChilds())); getWidget()->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(getWidget(), SIGNAL(clicked(QModelIndex)), this, SLOT(onClickedAtFileTree(QModelIndex))); //connect(getWidget(), SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onDoubleClickedAtFileTree(QModelIndex))); getWidget()->header()->hide(); connect(m_ui->filterFileComboBox, SIGNAL(editTextChanged(QString)), this, SLOT(onFilterFileComboChanged(QString))); bool const cancel_on = !m_ui->filterFileComboBox->currentText().isEmpty(); m_ui->cancelFilterButton->setEnabled(cancel_on); connect(m_ui->cancelFilterButton, SIGNAL(clicked()), this, SLOT(onCancelFilterFileButton())); connect(m_ui->allButton, SIGNAL(clicked()), this, SLOT(onSelectAll())); connect(m_ui->noneButton, SIGNAL(clicked()), this, SLOT(onSelectNone())); }
///////// lvl filters void FilterLvl::setupModel () { if (!m_model) { qDebug("new tree view lvl model"); m_model = new QStandardItemModel; } m_ui->view->setModel(m_model); m_ui->view->setSortingEnabled(true); m_ui->view->expandAll(); LevelDelegate * d = new LevelDelegate(this); m_ui->view->setItemDelegate(d); //m_ui->view->setRootIndex(m_model->indexFromItem(m_model->invisibleRootItem())); m_ui->view->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(m_ui->view, SIGNAL(clicked(QModelIndex)), this, SLOT(onClicked(QModelIndex))); connect(m_ui->allButton, SIGNAL(clicked()), this, SLOT(onSelectAll())); connect(m_ui->noneButton, SIGNAL(clicked()), this, SLOT(onSelectNone())); m_ui->view->header()->hide(); }
QgsOSMExportDialog::QgsOSMExportDialog( QWidget *parent ) : QDialog( parent ) , mDatabase( new QgsOSMDatabase ) { setupUi( this ); connect( btnBrowseDb, SIGNAL( clicked() ), this, SLOT( onBrowse() ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( onClose() ) ); connect( editDbFileName, SIGNAL( textChanged( QString ) ), this, SLOT( updateLayerName() ) ); connect( radPoints, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) ); connect( radPolylines, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) ); connect( radPolygons, SIGNAL( clicked() ), this, SLOT( updateLayerName() ) ); connect( btnLoadTags, SIGNAL( clicked() ), this, SLOT( onLoadTags() ) ); connect( btnSelectAll, SIGNAL( clicked() ), this, SLOT( onSelectAll() ) ); connect( btnUnselectAll, SIGNAL( clicked() ), this, SLOT( onUnselectAll() ) ); mTagsModel = new QStandardItemModel( this ); mTagsModel->setHorizontalHeaderLabels( QStringList() << tr( "Tag" ) << tr( "Count" ) << tr( "Not null" ) ); viewTags->setModel( mTagsModel ); }
///////// colorizer void ColorizerRow::setupModel () { if (!m_model) { qDebug("new tree view model"); m_model = new QStandardItemModel; } m_ui->view->setModel(m_model); QStringList l; l.append("Enabled"); l.append("Row"); l.append("fg"); l.append("bg"); m_model->setHorizontalHeaderLabels(l); //m_ui->view->model()->setHeaderData(0, Qt::Horizontal, "Enabled"); //m_ui->view->model()->setHeaderData(1, Qt::Horizontal, "Reg Exp"); //m_ui->view->model()->setHeaderData(2, Qt::Horizontal, "fg"); //m_ui->view->model()->setHeaderData(3, Qt::Horizontal, "bg"); //m_ui->view->setSortingEnabled(true); m_ui->view->expandAll(); m_model->setColumnCount(4); m_ui->view->setColumnWidth(0, 192); ColorizerRowDelegate * d = new ColorizerRowDelegate(this); m_ui->view->setItemDelegate(d); m_ui->view->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(onAdd())); connect(m_ui->comboBox->lineEdit(), SIGNAL(returnPressed()), this, SLOT(onAdd())); connect(m_ui->rmButton, SIGNAL(clicked()), this, SLOT(onRm())); connect(m_ui->view, SIGNAL(clicked(QModelIndex)), this, SLOT(onClickedAt(QModelIndex))); connect(m_ui->allButton, SIGNAL(clicked()), this, SLOT(onSelectAll())); connect(m_ui->noneButton, SIGNAL(clicked()), this, SLOT(onSelectNone())); m_ui->fgButton->setStandardColors(); m_ui->fgButton->setCurrentColor(QColor(Qt::black)); m_ui->bgButton->setStandardColors(); m_ui->bgButton->setCurrentColor(QColor(Qt::white)); }
PageEntryDialog::PageEntryDialog(int pageset,QWidget * parent) : QDialog(parent) { QLOG_DEBUG() << Q_FUNC_INFO; QSqlQuery p(QSqlDatabase::database("notesdb")); if (! p.prepare(SQL_PAGESET_DETAIL)) { QLOG_WARN() << QString(tr("Prepare failed for SQL_PAGESET_DETAIL query:%1")).arg(p.lastError().text()); } /// we shouldn't have sql errors, but this should fail gracefully p.bindValue(0,pageset); p.exec(); int page = 0; QVBoxLayout * layout = new QVBoxLayout; QMap<int,QString> hm; QStringList cols; cols << tr("Select") << tr("Node") << tr("Root") << tr("Headword") << tr("Volume/Page") << tr("Id"); m_pages = new ColumnarTableWidget(cols); m_pages->setKey(ColumnarTableWidget::STATE,SID_PAGESET_PAGEENTRY_STATE); m_pages->setSelectionMode(QAbstractItemView::SingleSelection); m_pages->verticalHeader()->setVisible(false); QString html; QLabel * label; while(p.next()) { Place n = Place::fromString(p.record().value("place").toString()); if (n.isValid()) { page = m_pages->rowCount(); m_pages->insertRow(page); m_pages->setItem(page,PAGE_NODE_COLUMN,new QTableWidgetItem(n.m_node)); m_pages->item(page,PAGE_NODE_COLUMN)->setTextAlignment(Qt::AlignCenter); html = qobject_cast<Lexicon *>(qApp)->scanAndStyle(n.m_root,"pageset"); label = new QLabel(html);; label->setAlignment(Qt::AlignCenter); m_pages->setCellWidget(page,PAGE_ROOT_COLUMN,label); html = qobject_cast<Lexicon *>(qApp)->scanAndStyle(n.m_word,"pageset"); label = new QLabel(html);; label->setAlignment(Qt::AlignCenter); m_pages->setCellWidget(page,PAGE_WORD_COLUMN,label); m_pages->setCellWidget(page,PAGE_LOAD_COLUMN,new CenteredCheckBox); m_pages->setItem(page,PAGE_VOLUME_COLUMN,new QTableWidgetItem(n.format("%V/%P"))); m_pages->item(page,PAGE_VOLUME_COLUMN)->setTextAlignment(Qt::AlignCenter); m_pages->setItem(page,PAGE_ID_COLUMN,new QTableWidgetItem(p.record().value("id").toString())); } } int rows = m_pages->rowCount(); if (m_pages->rowCount() == 0) { m_pages->clear(); m_pages->insertRow(0); m_pages->setColumnCount(1); m_pages->setHorizontalHeaderLabels(QStringList() << ""); m_pages->horizontalHeader()->setStretchLastSection(true); QLabel * m = new QLabel(tr("<em>No pages found</em>")); m->setAlignment(Qt::AlignCenter); m_pages->setCellWidget(0,0,m); } else { QTableWidgetItem * item; QList<int> cols; cols << PAGE_NODE_COLUMN << PAGE_VOLUME_COLUMN << PAGE_ID_COLUMN; for(int i=0;i < m_pages->rowCount();i++) { for(int j=0;j < cols.size();j++) { item = m_pages->item(i,cols[j]); item->setFlags(item->flags() ^ Qt::ItemIsEditable); } } } m_pages->hideColumn(PAGE_ID_COLUMN); m_pages->resizeColumnsToContents(); layout->addWidget(m_pages); QDialogButtonBox * buttonBox; if (rows > 0) { buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); QPushButton * btn1 = new QPushButton(tr("Select all")); buttonBox->addButton(btn1,QDialogButtonBox::ActionRole); connect(btn1,SIGNAL(clicked()),this,SLOT(onSelectAll())); QPushButton * btn2 = new QPushButton(tr("Clear Selections")); buttonBox->addButton(btn2,QDialogButtonBox::ActionRole); connect(btn2,SIGNAL(clicked()),this,SLOT(onClearSelections())); } else { buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel); } connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); layout->addWidget(buttonBox); setLayout(layout); /// SETTINGS settings.beginGroup("PageSets"); m_pages->readConfiguration(settings); }