NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) : QDialog(parent), m_ui(new Ui::NickNameDialog), m_model(model), m_filterModel(new QSortFilterProxyModel(this)) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_ui->setupUi(this); okButton()->setEnabled(false); // Populate model and grow tree to accommodate it m_filterModel->setSourceModel(model); m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_ui->filterTreeView->setModel(m_filterModel); const int columnCount = m_filterModel->columnCount(); int treeWidth = 0; for (int c = 0; c < columnCount; c++) { m_ui->filterTreeView->resizeColumnToContents(c); treeWidth += m_ui->filterTreeView->columnWidth(c); } m_ui->filterTreeView->setMinimumWidth(treeWidth + 20); connect(m_ui->filterTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotDoubleClicked(QModelIndex))); connect(m_ui->filterTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(slotCurrentItemChanged(QModelIndex))); connect(m_ui->filterLineEdit, SIGNAL(filterChanged(QString)), m_filterModel, SLOT(setFilterFixedString(QString))); }
void WidgetMain::showEvent(QShowEvent *event) { Q_UNUSED(event); //pSerialPortTool_->show(); pushButtonInfor->move(widgetTitle->width() * 1/2 - pushButtonInfor->width() / 2, 0); widgetLoginInfor->move((widgetTitle->width() * 3/4) - (widgetLoginInfor->width() / 2), 0); widgetLoginInfor->hide(); //应该根据QSetting来进行配置 splitter_2->setSizes(QList<int>() << 120 << 130); splitter_4->setSizes(QList<int>() << 450 << 150); { QSettings settingTmp("./resource/setting.ini", QSettings::IniFormat); QString value = settingTmp.value(tr("Normal/default")).toString(); if("begin" == value) { splitter->setSizes(QList<int>() << 181 << width()-181); { QListWidgetItem *pCurrent = listWidgetMenu->item(0); QListWidgetItem *pprevious = listWidgetMenu->item(1); stackedWidget->setCurrentIndex(0); slotCurrentItemChanged(pCurrent, pprevious); } } else if("advanced" == value) { stackedWidget->setCurrentIndex(1); splitter->setSizes(QList<int>() << 250 << width()-250); { QListWidgetItem *pCurrent = listWidgetMenu->item(1); QListWidgetItem *pPrevious = listWidgetMenu->item(0); stackedWidget->setCurrentIndex(1); slotCurrentItemChanged(pCurrent, pPrevious); } } else { qDebug() << "QSetting 读取数据失败!" <<value; } } //pEditScene_->setInitScroll(0, -460); }
int OutputPatchEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: reject(); break; case 1: slotCurrentItemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; case 2: slotItemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; case 3: slotConfigureClicked(); break; case 4: slotPluginConfigurationChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 5: slotReconnectClicked(); break; case 6: slotZeroBasedDMXClicked(); break; default: ; } _id -= 7; } return _id; }