ComposerAttachmentsList::ComposerAttachmentsList(QWidget *parent): QListView(parent), m_dragging(false), m_dragInside(false), m_composer(0) { setMouseTracking( true ); setAcceptDrops(true); setDragDropMode( DragDrop ); setDragDropOverwriteMode( false ); setDragEnabled(true); setDropIndicatorShown(false); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); m_actionSendInline = new QAction(tr("Send Inline"), this); m_actionSendInline->setCheckable(true); connect(m_actionSendInline, SIGNAL(triggered(bool)), this, SLOT(slotToggledContentDispositionInline(bool))); addAction(m_actionSendInline); m_actionRename = new QAction(tr("Rename..."), this); connect(m_actionRename, SIGNAL(triggered()), this, SLOT(slotRenameAttachment())); addAction(m_actionRename); m_actionRemoveAttachment = new QAction(tr("Remove"), this); connect(m_actionRemoveAttachment, SIGNAL(triggered()), this, SLOT(slotRemoveAttachment())); addAction(m_actionRemoveAttachment); connect(this, SIGNAL(itemDroppedOut()), this, SLOT(slotRemoveAttachment())); connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(onCurrentChanged())); connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(onCurrentChanged())); }
QTextEdit * Editor::addEditor(const QString & name, const Effect * effect, int i) { SourceEdit * textEdit = new SourceEdit(this); this->addTab(textEdit, name); textEdit->setFont(m_font); textEdit->setLineWrapMode(QTextEdit::NoWrap); textEdit->setTabStopWidth(28); textEdit->setAcceptRichText(false); QTextDocument * textDocument = textEdit->document(); Highlighter * hl = new Highlighter(textDocument); hl->setRules(effect->factory()->highlightingRules()); hl->setMultiLineCommentStart(effect->factory()->multiLineCommentStart()); hl->setMultiLineCommentEnd(effect->factory()->multiLineCommentEnd()); textEdit->setPlainText(effect->getInput(i)); textDocument->setModified(false); connect(textEdit, SIGNAL(textChanged()), this, SIGNAL(textChanged())); connect(textEdit, SIGNAL(cursorPositionChanged()), this, SIGNAL(cursorPositionChanged())); connect(textDocument, SIGNAL(modificationChanged(bool)), this, SIGNAL(modifiedChanged(bool))); if (count() == 1) { emit onCurrentChanged(currentIndex()); } return textEdit; }
void ComposerAttachmentsList::onAttachmentNumberChanged() { Q_ASSERT(model()); bool current = currentIndex().isValid(); m_actionRemoveAttachment->setEnabled(current); m_actionSendInline->setEnabled(current); m_actionRename->setEnabled(current); onCurrentChanged(); }
void VBoxSnapshotsWgt::sessionStateChanged(QString strId, KSessionState state) { SnapshotEditBlocker guardBlock (mEditProtector); if (strId != mMachineId) return; mSessionState = state; onCurrentChanged (mTreeWidget->currentItem()); }
void OnyxPlayerView::attachModel(PlayListModel *m) { model_ = m; connect(model_, SIGNAL(firstAdded()), this, SLOT(play())); connect(model_, SIGNAL(loadingFinished()), this, SLOT(onLoadingFinished())); connect(model_, SIGNAL(currentChanged()), this, SLOT(onCurrentChanged())); model_->doCurrentVisibleRequest(); loadSettings(); }
bool AddFriendForm::addFriendRequest(const QString &friendAddress, const QString &message) { if (Settings::getInstance().addFriendRequest(friendAddress, message)) { addFriendRequestWidget(friendAddress, message); if (isShown()) onCurrentChanged(tabWidget->currentIndex()); return true; } return false; }
void AddFriendForm::show(ContentLayout* contentLayout) { contentLayout->mainContent->layout()->addWidget(tabWidget); contentLayout->mainHead->layout()->addWidget(head); tabWidget->show(); head->show(); setIdFromClipboard(); toxId.setFocus(); // Fix #3421 // Needed to update tab after opening window int index = tabWidget->currentIndex(); onCurrentChanged(index); }
void OnyxPlayerView::deattachModel() { if (model_ != 0) { // clear data ODatas empty_data; song_list_view_.setData(empty_data); disconnect(model_, SIGNAL(firstAdded()), this, SLOT(play())); disconnect(model_, SIGNAL(loadingFinished()), this, SLOT(onLoadingFinished())); disconnect(model_, SIGNAL(currentChanged()), this, SLOT(onCurrentChanged())); model_ = 0; } }
void QgsLayerTreeView::modelRowsInserted( QModelIndex index, int start, int end ) { QgsLayerTreeNode* parentNode = layerTreeModel()->index2node( index ); if ( !parentNode ) return; if ( QgsLayerTree::isLayer( parentNode ) ) return; // layers have only symbology nodes (no expanded/collapsed handling) QList<QgsLayerTreeNode*> children = parentNode->children(); for ( int i = start; i <= end; ++i ) { updateExpandedStateFromNode( children[i] ); } // make sure we still have correct current layer onCurrentChanged(); }
void CarShopMenu::gameStateLoaded(Client::State* state) { model.reset(new VehicleTableModel(state->getShopVehicles())); TableView* view = ui->carList; view->setModel(model.get()); connect(ui->carList->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(onCurrentChanged(QModelIndex, QModelIndex))); view->showColumn(model->name.getIndex()); view->showColumn(model->price.getIndex()); view->horizontalHeader()->setResizeMode(model->name.getIndex(), QHeaderView::Stretch); player = state->getPlayer(); vehicle = nullptr; }
void VBoxSnapshotsWgt::refreshAll() { SnapshotEditBlocker guardBlock (mEditProtector); if (mMachine.isNull()) { onCurrentChanged(); return; } QString selectedItem, firstChildOfSelectedItem; SnapshotWgtItem *cur = !mTreeWidget->currentItem() ? 0 : static_cast <SnapshotWgtItem*> (mTreeWidget->currentItem()); if (cur) { selectedItem = cur->snapshotId(); if (cur->child (0)) firstChildOfSelectedItem = static_cast <SnapshotWgtItem*> (cur->child (0))->snapshotId(); } mTreeWidget->clear(); /* Get the first snapshot */ if (mMachine.GetSnapshotCount() > 0) { CSnapshot snapshot = mMachine.FindSnapshot(QString::null); populateSnapshots (snapshot, 0); Assert (mCurSnapshotItem); /* Add the "current state" item */ SnapshotWgtItem *csi = new SnapshotWgtItem (mCurSnapshotItem, mMachine); csi->setBold (true); csi->recache(); SnapshotWgtItem *cur = findItem (selectedItem); if (cur == 0) cur = findItem (firstChildOfSelectedItem); if (cur == 0) cur = curStateItem(); mTreeWidget->scrollToItem (cur); mTreeWidget->setCurrentItem (cur); onCurrentChanged (cur); } else { mCurSnapshotItem = 0; /* Add the "current state" item */ SnapshotWgtItem *csi = new SnapshotWgtItem (mTreeWidget, mMachine); csi->setBold (true); csi->recache(); mTreeWidget->setCurrentItem (csi); onCurrentChanged (csi); } /* Updating age */ updateSnapshotsAge(); mTreeWidget->resizeColumnToContents (0); }
void QgsLayerTreeView::setModel( QAbstractItemModel* model ) { if ( !qobject_cast<QgsLayerTreeModel*>( model ) ) return; connect( model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( modelRowsInserted( QModelIndex, int, int ) ) ); connect( model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( modelRowsRemoved() ) ); QTreeView::setModel( model ); connect( layerTreeModel()->rootGroup(), SIGNAL( expandedChanged( QgsLayerTreeNode*, bool ) ), this, SLOT( onExpandedChanged( QgsLayerTreeNode*, bool ) ) ); connect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SLOT( onCurrentChanged() ) ); connect( layerTreeModel(), SIGNAL( modelReset() ), this, SLOT( onModelReset() ) ); updateExpandedStateFromNode( layerTreeModel()->rootGroup() ); }
void JoinGroupChat::showEvent(QShowEvent *ev) { QDialog::showEvent(ev); onCurrentChanged(0); }
void fileBrowserWidget::setupModel(QList<files> &list) { model = new QStandardItemModel(list.size(), 6, ui.fileTable); model->setHeaderData(0, Qt::Horizontal, tr("Icon")); model->setHeaderData(1, Qt::Horizontal, tr("Demo Name")); model->setHeaderData(2, Qt::Horizontal, tr("Title")); model->setHeaderData(3, Qt::Horizontal, tr("Disc ID")); model->setHeaderData(4, Qt::Horizontal, tr("FW")); ui.fileTable->setModel(model); QItemSelectionModel *selectionModel = new QItemSelectionModel(model,this); ui.fileTable->setSelectionModel(selectionModel); // ui.savesTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch); ui.fileTable->verticalHeader()->setDefaultSectionSize(40); ui.fileTable->setColumnWidth(0,72); ui.fileTable->setColumnWidth(1,150); ui.fileTable->setColumnWidth(2,180); ui.fileTable->setColumnWidth(3,100); ui.fileTable->setColumnWidth(4,50); ui.fileTable->hideColumn(5); model->removeRows(0, model->rowCount(QModelIndex()), QModelIndex());//clear data for (int i = 0; i < list.size(); i++) { model->insertRows(i, 1, QModelIndex()); //display icon0 in half size to save some space int icon0width = list[i].getIcon().width(); int icon0height = list[i].getIcon().height(); model->setData(model->index(i, 0, QModelIndex()),QPixmap(list[i].getIcon().scaled(QSize(icon0width/2,icon0height/2))),Qt::DecorationRole); model->setData(model->index(i, 1, QModelIndex()),list[i].getFileName()); model->setData(model->index(i, 2, QModelIndex()),list[i].getDemosTitle()); model->setData(model->index(i, 3, QModelIndex()),list[i].getDemosID()); model->setData(model->index(i, 4, QModelIndex()),list[i].getDemosFW()); model->setData(model->index(i, 5, QModelIndex()),list[i].getPath()); } connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), this, SLOT(onCurrentChanged(QModelIndex))); }
void QgsLayerTreeView::modelRowsRemoved() { // make sure we still have correct current layer onCurrentChanged(); }