void ScreenTab::setTabName(const QString &name) { if (_screen->getName() != name) { _screen->setName(name); } emit tabNameChanged(name); }
void ClipboardModel::setTabName(const QString &tabName) { if (m_tabName == tabName) return; m_tabName = tabName; emit tabNameChanged(m_tabName); }
void ClipboardModel::setTabName(const QString &tabName) { Q_ASSERT( !tabName.isEmpty() ); if (m_tabName == tabName) return; m_tabName = tabName; emit tabNameChanged(m_tabName); }
void ClipboardBrowser::connectModelAndDelegate() { Q_ASSERT(&m != model()); // set new model QAbstractItemModel *oldModel = model(); setModel(&m); delete oldModel; // delegate for rendering and editing items setItemDelegate(&d); connect( &m, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(onDataChanged(QModelIndex,QModelIndex)) ); connect( &m, SIGNAL(tabNameChanged(QString)), SLOT(onTabNameChanged(QString)) ); connect( &m, SIGNAL(unloaded()), SLOT(onModelUnloaded()) ); // update on change connect( &m, SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(onModelDataChanged()) ); connect( &m, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), SLOT(onModelDataChanged()) ); connect( &m, SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(onItemCountChanged()) ); connect( &m, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(onItemCountChanged()) ); connect( &m, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)), SLOT(onModelDataChanged()) ); connect( &m, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(onModelDataChanged()) ); connect( &d, SIGNAL(rowSizeChanged()), SLOT(updateCurrentPage()) ); connect( &m, SIGNAL(rowsInserted(QModelIndex, int, int)), &d, SLOT(rowsInserted(QModelIndex, int, int)) ); connect( &m, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), &d, SLOT(rowsRemoved(QModelIndex,int,int)) ); connect( &m, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)), &d, SLOT(rowsMoved(QModelIndex, int, int, QModelIndex, int)) ); connect( &m, SIGNAL(dataChanged(QModelIndex,QModelIndex)), &d, SLOT(dataChanged(QModelIndex,QModelIndex)) ); updateCurrentPage(); }
void DatabaseTabWidget::updateTabName(Database* db) { int index = databaseIndex(db); Q_ASSERT(index != -1); const DatabaseManagerStruct& dbStruct = m_dbList.value(db); QString tabName; if (dbStruct.saveToFilename || dbStruct.readOnly) { if (db->metadata()->name().isEmpty()) { tabName = dbStruct.fileName; } else { tabName = db->metadata()->name(); } setTabToolTip(index, dbStruct.filePath); } else { if (db->metadata()->name().isEmpty()) { tabName = tr("New database"); } else { tabName = QString("%1 [%2]").arg(db->metadata()->name(), tr("New database")); } } if (dbStruct.dbWidget->currentMode() == DatabaseWidget::LockedMode) { tabName.append(QString(" [%1]").arg(tr("locked"))); } if (dbStruct.modified) { tabName.append("*"); } setTabText(index, tabName); Q_EMIT tabNameChanged(); }