TreeComboFilterItemWidget::TreeComboFilterItemWidget(const QString & labelText, const int filterTag, bool removableItem, QWidget *parent) : FilterItemWidget(filterTag, removableItem, parent), _deleteBtn(0) { QLabel * label = new QLabel(labelText); _comboBox = new TreeViewComboBox; _comboBox->setMinimumContentsLength(22); _comboBox->setMaxVisibleItems(40); _comboBox->installEventFilter(this); label->setBuddy(_comboBox); QHBoxLayout * layout = new QHBoxLayout; layout->setAlignment(Qt::AlignVCenter); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(label); layout->addSpacing(2); layout->addWidget(_comboBox); if(removableItem){ _deleteBtn = createDeleteButton(); _deleteBtn->installEventFilter(this); connect(_deleteBtn, SIGNAL(clicked()), this, SLOT(slotDeleteItem())); layout->addWidget(_deleteBtn); } setLayout(layout); connect(_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int))); }
CTrackList::CTrackList(QWidget *parent, double tz) : QDialog(parent), ui(new Ui::CTrackList) { ui->setupUi(this); setWindowFlags(((windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowCloseButtonHint)); QStandardItemModel *model = new QStandardItemModel(0, 4); model->setHeaderData(0, Qt::Horizontal, tr("Name")); model->setHeaderData(1, Qt::Horizontal, tr("From")); model->setHeaderData(2, Qt::Horizontal, tr("To")); model->setHeaderData(3, Qt::Horizontal, tr("Steps")); for (int i = 0; i < tTracking.count(); i++) { QStandardItem *item = new QStandardItem; item->setText(tTracking[i].objName); item->setCheckable(true); if (tTracking[i].show) { item->setCheckState(Qt::Checked); } model->setItem(i, 0, item); item = new QStandardItem; item->setText(getStrDate(tTracking[i].jdFrom, tz) + " " + getStrTime(tTracking[i].jdFrom, tz, true)); model->setItem(i, 1, item); item = new QStandardItem; item->setText(getStrDate(tTracking[i].jdTo, tz) + " " + getStrTime(tTracking[i].jdTo, tz, true)); model->setItem(i, 2, item); item = new QStandardItem; item->setText(QString::number(tTracking[i].tPos.count())); model->setItem(i, 3, item); } ui->treeView->setModel(model); ui->treeView->setRootIsDecorated(false); ui->treeView->header()->resizeSection(0, 100); ui->treeView->header()->resizeSection(1, 120); ui->treeView->header()->resizeSection(2, 120); ui->treeView->header()->resizeSection(3, 60); QShortcut *sh1 = new QShortcut(QKeySequence(Qt::Key_Delete), ui->treeView, 0, 0, Qt::WidgetShortcut); connect(sh1, SIGNAL(activated()), this, SLOT(slotDeleteItem())); }
void editor::initActions() { fileNew = new QAction(QIcon(":/icons/filenew.png"),tr("&New"),this); fileNew->setShortcut(tr("Ctrl+N")); fileNew->setStatusTip(tr("Create a new image")); connect(fileNew, SIGNAL(triggered()), this, SLOT(slotFileNew())); fileOpen = new QAction(QIcon(":/icons/fileopen.png"),tr("&Open"),this); fileOpen->setShortcut(tr("Ctrl+O")); fileOpen->setStatusTip(tr("Open an image file")); connect(fileOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen())); fileSave = new QAction(QIcon(":/icons/filesave.png"),tr("&Save file .."),this); fileSave->setStatusTip(tr("Save the file under the same name and format")); connect(fileSave, SIGNAL(triggered()), this, SLOT(slotFileSave())); fileSaveImage = new QAction(tr("Save &Image file .."),this); fileSaveImage->setStatusTip(tr("Save the file in PNG format")); connect(fileSaveImage, SIGNAL(triggered()), this, SLOT(slotFileSaveImage())); fileSaveTemplate = new QAction(("Save &Template .."),this); fileSaveTemplate->setStatusTip(tr("Save template file ")); connect(fileSaveTemplate, SIGNAL(triggered()), this, SLOT(slotFileSaveTemplate())); fileQuit = new QAction(tr("Quit"),this); fileQuit->setShortcut(tr("Ctrl+Q")); fileQuit->setStatusTip(tr("Quits the editor")); connect(fileQuit, SIGNAL(triggered()), this, SLOT(slotFileQuit())); clearAll= new QAction(QIcon(":/icons/eraser.png"),tr("Clear &All"),this); clearAll->setShortcut(tr("Ctrl+A")); clearAll->setStatusTip(tr("Delete all objects and fill the background with the background color")); connect(clearAll, SIGNAL(triggered()), ev, SLOT(slotClearAll())); copy= new QAction(tr("Copy"),this); copy->setShortcut(tr("Ctrl+C")); connect(copy, SIGNAL(triggered()), ev->getScene(), SLOT(slotCopy())); paste= new QAction(tr("Paste"),this); paste->setShortcut(tr("Ctrl+V")); connect(paste, SIGNAL(triggered()), ev->getScene(), SLOT(slotPaste())); deleteAction=new QAction(tr("&Delete"),this); deleteAction->setShortcut(tr("Del")); connect(deleteAction, SIGNAL(triggered()), ev->getScene(), SLOT(slotDeleteItem())); dump= new QAction(tr("dump"),this); connect(dump, SIGNAL(triggered()), ev, SLOT(slotDump())); }
/* * The signal that tells that a directory was deleted may arrive before the signal * for its children arrive. Thus, we must walk through the children of a dir and * remove them before removing the dir itself. */ void KFileTreeBranch::slotDeleteItem( KFileItem *it ) { if( !it ) return; kdDebug(250) << "Slot Delete Item hitted for " << it->url().prettyURL() << endl; KFileTreeViewItem *kfti = static_cast<KFileTreeViewItem*>(it->extraData(this)); if( kfti ) { kdDebug( 250 ) << "Child count: " << kfti->childCount() << endl; if( kfti->childCount() > 0 ) { KFileTreeViewItem *child = static_cast<KFileTreeViewItem*>(kfti->firstChild()); while( child ) { kdDebug(250) << "Calling child to be deleted !" << endl; KFileTreeViewItem *nextChild = static_cast<KFileTreeViewItem*>(child->nextSibling()); slotDeleteItem( child->fileItem()); child = nextChild; } } kdDebug(250) << "Found corresponding KFileTreeViewItem" << endl; if( m_lastFoundURL.equals(it->url(), true )) { m_lastFoundURL = KURL(); m_lastFoundItem = 0L; } delete( kfti ); } else { kdDebug(250) << "Error: tdefiletreeviewitem: "<< kfti << endl; } }
ClsQSAList::ClsQSAList ( QWidget * parent, ClsQGroupStateManip* _clsQGroupStateManip, const char * name, WFlags f) : QFrame ( parent, name, f ), clsQGroupStateManip(_clsQGroupStateManip) { strFilename = "";///home/ulysses/STATESEQ"; QVBoxLayout* layoutMain = new QVBoxLayout( this, 5, -1, "mainL"); /* ------------------------------- */ qlbox = new QListBox( this ); qlbox->setVScrollBarMode(QScrollView::AlwaysOn); // qlbox->setHScrollBarMode(QScrollView::AlwaysOff); // qlbox->setColumnMode ( QListBox::FitToWidth ); // qlbox->setColumnMode ( QListBox::FixedNumber ); qlbox->setFixedWidth ( 150 ); // qlbox->setResizePolicy(QScrollView::AutoOne); qlbox->setSelectionMode(QListBox::Extended); cQListBoxToolTip = new GQListBoxToolTip(qlbox); connect(qlbox, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(slotDoubleClicked(QListBoxItem*))); layoutMain->addWidget(qlbox,10); // layoutMain->addMultiCellWidget(qlbox, 0, 0,0,3); QGridLayout* layoutButtons = new QGridLayout( 2, 6, -1, "layoutButtons"); layoutButtons->setColStretch ( 0, 50 ); /* ------------------------------- */ //-- QHBoxLayout* qlayoutEdit = new QHBoxLayout( layoutMain); QPushButton* qpbtnMoveUp = new QPushButton (QIconSet(QPixmap(up)), "",this); qpbtnMoveUp->setFlat(TRUE); connect(qpbtnMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUp())); //-- qlayoutEdit->addWidget(qpbtnMoveUp); layoutButtons->addWidget(qpbtnMoveUp,0,1); QPushButton* qpbtnMoveDown = new QPushButton (QIconSet(QPixmap(down)), "",this); qpbtnMoveDown->setFlat(TRUE); connect(qpbtnMoveDown, SIGNAL(clicked()), this, SLOT(slotMoveDown())); //-- qlayoutEdit->addWidget(qpbtnMoveDown); layoutButtons->addWidget(qpbtnMoveDown,0,2); QPushButton* qpbtnInvert = new QPushButton (QIconSet(QPixmap(invert2)), "",this); qpbtnInvert->setFlat(TRUE); connect(qpbtnInvert, SIGNAL(clicked()), this, SLOT(slotInvert())); //-- qlayoutEdit->addWidget(qpbtnInvert); layoutButtons->addWidget(qpbtnInvert,0,3); QPushButton* qpbtnDelete = new QPushButton (QIconSet(QPixmap(trash2)), "",this); connect(qpbtnDelete, SIGNAL(clicked()), this, SLOT(slotDeleteItem())); qpbtnDelete->setFlat(TRUE); //-- qlayoutEdit->addWidget(qpbtnDelete); layoutButtons->addWidget(qpbtnDelete,0,4); /* ------------------------------- */ //-- QHBoxLayout* qlayout2 = new QHBoxLayout( layoutMain); QPushButton* qpbtnSave = new QPushButton (QIconSet(QPixmap(filesave)), "",this); connect(qpbtnSave, SIGNAL(clicked()), this, SLOT(slotSave())); qpbtnSave->setFlat(TRUE); //-- qlayout2->addWidget(qpbtnSave); layoutButtons->addWidget(qpbtnSave,1,1); QPushButton* qpbtnSaveAs = new QPushButton (QIconSet(QPixmap(filesaveas)), "",this); connect(qpbtnSaveAs, SIGNAL(clicked()), this, SLOT(slotSaveAs())); qpbtnSaveAs->setFlat(TRUE); //-- qlayout2->addWidget(qpbtnSaveAs); layoutButtons->addWidget(qpbtnSaveAs,1,2); QPushButton* qpbtnLoad = new QPushButton (QIconSet(QPixmap(fileopen)), "",this); connect(qpbtnLoad, SIGNAL(clicked()), this, SLOT(slotLoad())); qpbtnLoad->setFlat(TRUE); //-- qlayout2->addWidget(qpbtnLoad); layoutButtons->addWidget(qpbtnLoad,1,4); layoutButtons->setColStretch ( 5, 50 ); QToolTip::add(qpbtnMoveUp, "Move up"); QToolTip::add(qpbtnMoveDown, "Move down"); QToolTip::add(qpbtnInvert, "Invert order"); QToolTip::add(qpbtnDelete, "Delete"); QToolTip::add(qpbtnSave, "Save Sequence"); QToolTip::add(qpbtnSaveAs, "Save Sequence under new name"); QToolTip::add(qpbtnLoad, "Load Sequence"); qpbtnMoveUp->setMaximumSize (QSize(22,22)); qpbtnMoveDown->setMaximumSize (QSize(22,22)); qpbtnInvert->setMaximumSize (QSize(22,22)); qpbtnDelete->setMaximumSize (QSize(22,22)); qpbtnSave->setMaximumSize (QSize(22,22)); qpbtnSaveAs->setMaximumSize (QSize(22,22)); qpbtnLoad->setMaximumSize (QSize(22,22)); // layoutMain->setResizeMode (QLayout::Fixed); layoutMain->addLayout(layoutButtons); // this->setFixedWidth(this->sizeHint().width()); // cout << "qlbox->visibleWidth (): " << qlbox->visibleWidth () << endl; iListViewVisibleWidth = qlbox->visibleWidth () + 5;//- qlbox->verticalScrollBar()->width(); }
void CTrackList::on_pushButton_2_clicked() { slotDeleteItem(); }
CWPosSel::CWPosSel(QWidget *parent, mapView_t *view) : ////////////////////////////////////////////////////// QDialog(parent), ui(new Ui::CWPosSel) { ui->setupUi(this); m_earthTools.setCacheFolder(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/cache"); connect(&m_earthTools, SIGNAL(sigDone(bool,double,int)), this, SLOT(slotETDone(bool,double,int))); connect(&m_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotLocationDone(QNetworkReply*))); SkFile f(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/data/locations/locations.dat"); if (f.open(SkFile::ReadOnly | SkFile::Text)) { QString str; QStringList l; do { str = f.readLine(); if (str.isEmpty() || str.startsWith("\n")) break; l = str.split("|"); if (l.count() != 5) { qDebug("CWPosSel read line fail!"); continue; } location_t *loc = new location_t; loc->name = l.at(0); loc->lon = l.at(1).toDouble(); loc->lat = l.at(2).toDouble(); loc->alt = l.at(3).toDouble(); loc->tz = l.at(4).toDouble(); m_tList.append(loc); QListWidgetItem *w = new QListWidgetItem(loc->name, NULL, 1); w->setData(Qt::UserRole, (qint64)loc); ui->listWidget->addItem(w); } while (1); f.close(); } ui->spinBox_8->setValue(view->geo.temp); ui->spinBox_9->setValue(view->geo.press); ui->checkBox->setChecked(!view->geo.useAtmRefraction); ui->cb_tempType->addItem("C"); ui->cb_tempType->addItem("F"); ui->cb_tempType->setCurrentIndex(view->geo.tempType); location_t loc; loc.name = view->geo.name; loc.lon = R2D(view->geo.lon); loc.lat = R2D(view->geo.lat); loc.alt = view->geo.alt; loc.tz = view->geo.tzo * 24.0; ui->doubleSpinBox_4->setValue(view->geo.sdlt * 24.0); m_view = view; setData(&loc); QShortcut *sh1 = new QShortcut(QKeySequence(Qt::Key_Delete), ui->listWidget, 0, 0, Qt::WidgetShortcut); connect(sh1, SIGNAL(activated()), this, SLOT(slotDeleteItem())); ui->widget->setModel((QSortFilterProxyModel *)ui->listWidget->model(), 0); connect(ui->widget, SIGNAL(sigSetSelection(QModelIndex&)), this, SLOT(slotSelChange(QModelIndex&))); SkFile file(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/data/locations/home.dat"); if (file.open(QFile::ReadOnly)) { QDataStream ds(&file); int count; ds >> count; for (int i = 0; i < count; i++) { location_t loc; ds >> loc.name; ds >> loc.alt; ds >> loc.lat; ds >> loc.lon; ds >> loc.tz; QVariant var; var.setValue(loc); ui->cb_home->addItem(loc.name, var); } }
ClsQSAList::ClsQSAList ( QWidget * parent, ClsQGroupStateManip* _clsQGroupStateManip, const char * name, Qt::WindowFlags f) : QFrame ( parent, name, f ), clsQGroupStateManip(_clsQGroupStateManip) { strFilename = ""; QVBoxLayout* layoutMain = new QVBoxLayout( this, 5, -1, "mainL"); /* ------------------------------- */ qlbox = new QListWidget ( this ); qlbox->setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOn ); // qlbox->setViewMode(QListView::IconMode); qlbox->setIconSize(QSize(60, 60)); qlbox->setSpacing(10); qlbox->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(qlbox, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotDoubleClicked(const QModelIndex &))); layoutMain->addWidget(qlbox,10); QGridLayout* layoutButtons = new QGridLayout( 2, 6, -1, "layoutButtons"); layoutButtons->setColStretch ( 0, 50 ); /* ------------------------------- */ QPushButton* qpbtnMoveUp = new QPushButton (QIconSet(QPixmap(up)), "",this); qpbtnMoveUp->setFlat(TRUE); connect(qpbtnMoveUp, SIGNAL(clicked()), this, SLOT(slotMoveUp())); layoutButtons->addWidget(qpbtnMoveUp,0,1); QPushButton* qpbtnMoveDown = new QPushButton (QIconSet(QPixmap(down)), "",this); qpbtnMoveDown->setFlat(TRUE); connect(qpbtnMoveDown, SIGNAL(clicked()), this, SLOT(slotMoveDown())); layoutButtons->addWidget(qpbtnMoveDown,0,2); QPushButton* qpbtnInvert = new QPushButton (QIconSet(QPixmap(invert2)), "",this); qpbtnInvert->setFlat(TRUE); connect(qpbtnInvert, SIGNAL(clicked()), this, SLOT(slotInvert())); layoutButtons->addWidget(qpbtnInvert,0,3); QPushButton* qpbtnDelete = new QPushButton (QIconSet(QPixmap(trash2)), "",this); connect(qpbtnDelete, SIGNAL(clicked()), this, SLOT(slotDeleteItem())); qpbtnDelete->setFlat(TRUE); layoutButtons->addWidget(qpbtnDelete,0,4); /* ------------------------------- */ QPushButton* qpbtnSave = new QPushButton (QIconSet(QPixmap(fileSave_xpm)), "",this); connect(qpbtnSave, SIGNAL(clicked()), this, SLOT(slotSave())); qpbtnSave->setFlat(TRUE); layoutButtons->addWidget(qpbtnSave,1,1); QPushButton* qpbtnSaveAs = new QPushButton (QIconSet(QPixmap(fileSaveAs_xpm)), "",this); connect(qpbtnSaveAs, SIGNAL(clicked()), this, SLOT(slotSaveAs())); qpbtnSaveAs->setFlat(TRUE); layoutButtons->addWidget(qpbtnSaveAs,1,2); QPushButton* qpbtnLoad = new QPushButton (QIconSet(QPixmap(fileOpen_xpm)), "",this); connect(qpbtnLoad, SIGNAL(clicked()), this, SLOT(slotLoad())); qpbtnLoad->setFlat(TRUE); layoutButtons->addWidget(qpbtnLoad,1,4); layoutButtons->setColStretch ( 5, 50 ); QToolTip::add(qpbtnMoveUp, "Move up"); QToolTip::add(qpbtnMoveDown, "Move down"); QToolTip::add(qpbtnInvert, "Invert order"); QToolTip::add(qpbtnDelete, "Delete"); QToolTip::add(qpbtnSave, "Save Sequence"); QToolTip::add(qpbtnSaveAs, "Save Sequence under new name"); QToolTip::add(qpbtnLoad, "Load Sequence"); qpbtnMoveUp->setMaximumSize (QSize(22,22)); qpbtnMoveDown->setMaximumSize (QSize(22,22)); qpbtnInvert->setMaximumSize (QSize(22,22)); qpbtnDelete->setMaximumSize (QSize(22,22)); qpbtnSave->setMaximumSize (QSize(22,22)); qpbtnSaveAs->setMaximumSize (QSize(22,22)); qpbtnLoad->setMaximumSize (QSize(22,22)); layoutMain->addLayout(layoutButtons); }
EditorManagerView::EditorManagerView(const EditorManagerHelper *helper, BasicEntityTableModel *model, QWidget *parent) : Manhattan::MiniSplitter(parent), _helper(helper), _model(model), _dirty(false), _newRow(false) { _navigatorWidget = new ListNavigatorWidget(_helper->mainTitle()); _editorWidget = _helper->createEditor(); /* _buttonBox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel); _cancelButton = _buttonBox->button(QDialogButtonBox::Cancel); _cancelButton->setEnabled(false); _saveButton = _buttonBox->button(QDialogButtonBox::Save); _saveButton->setEnabled(false); _saveButton->setText(_helper->saveChangesButtonText()); _deleteButton = new QPushButton(_helper->deleteButtonText()); _buttonBox->addButton(_deleteButton, QDialogButtonBox::ResetRole); */ _deleteButton = new QPushButton(tr("Delete")); _deleteButton->setEnabled(false); _saveButton = new QPushButton(_helper->saveChangesButtonText()); //_saveButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogSaveButton))); _saveButton->setEnabled(false); _cancelButton = new QPushButton(tr("Cancel")); //_cancelButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogCancelButton))); _cancelButton->setEnabled(false); QHBoxLayout * actionsLayout = new QHBoxLayout; //actionsLayout->setMargin(6); actionsLayout->setSpacing(8); actionsLayout->addWidget(_deleteButton); actionsLayout->addStretch(); actionsLayout->addWidget(_saveButton); actionsLayout->addWidget(_cancelButton); QVBoxLayout * editorLayout = new QVBoxLayout; editorLayout->setMargin(9); editorLayout->addWidget(_editorWidget); editorLayout->addLayout(actionsLayout); QWidget * editorWapper = new QWidget; editorWapper->setLayout(editorLayout); _stackedLayout = new QStackedLayout; _stackedLayout->addWidget(helper->createNoDataWidget()); _stackedLayout->addWidget(editorWapper); QVBoxLayout * rightSideLayout = new QVBoxLayout; rightSideLayout->setMargin(0); rightSideLayout->setSpacing(0); rightSideLayout->addWidget(new Manhattan::StyledBar); rightSideLayout->addLayout(_stackedLayout); QWidget * rightSplitWidget = new QWidget; rightSplitWidget->setLayout(rightSideLayout); insertWidget(0, _navigatorWidget); insertWidget(1, rightSplitWidget); setStretchFactor(0, 0); setStretchFactor(1, 1); _model->select(); _filterProxyModel = new QSortFilterProxyModel(this); _filterProxyModel->setSourceModel(_model); _filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); _filterProxyModel->setFilterKeyColumn(model->getNameColumn()); _navigatorWidget->setModel(_filterProxyModel); _navigatorWidget->setModelColumn(model->getNameColumn()); _editorWidget->setModel(_model); _editorWidget->setCurrentIndex(-1); connect(_navigatorWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString))); connect(_navigatorWidget, SIGNAL(itemSelected(QModelIndex)), this, SLOT(slotItemSelected(QModelIndex)), Qt::QueuedConnection); connect(_navigatorWidget, SIGNAL(addNewItem()), this, SLOT(slotAddItem())); connect(_navigatorWidget, SIGNAL(deleteItem(QModelIndex)), this, SLOT(slotDeleteItem(QModelIndex))); connect(_editorWidget, SIGNAL(contentChanged()), this, SLOT(slotContentChanged())); //connect(_model, SIGNAL(primeInsert(int,QSqlRecord&)), this, SLOT(slotPrimeInsert(int,QSqlRecord&))); //connect(_buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept())); //connect(_buttonBox, SIGNAL(rejected()), this, SLOT(slotReject())); connect(_saveButton, SIGNAL(clicked(bool)), this, SLOT(slotAccept())); connect(_cancelButton, SIGNAL(clicked(bool)), this, SLOT(slotReject())); connect(_deleteButton, SIGNAL(clicked()), this, SLOT(slotDelete())); }