// Constructor. patchesDialog::patchesDialog( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog( pParent, wflags ) { // Setup UI struct... setupUi( this ); m_pSynth = NULL; m_iChan = 0; m_iBank = 0; m_iProg = 0; // Soundfonts list view... QHeaderView *pHeader = m_progListView->header(); // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setDefaultAlignment(Qt::AlignLeft); // pHeader->setDefaultSectionSize(200); #if QT_VERSION >= 0x050000 pHeader->setSectionsMovable(false); #else pHeader->setMovable(false); #endif pHeader->setStretchLastSection(true); m_progListView->resizeColumnToContents(0); // Prog. //pHeader->resizeSection(1, 200); // Name. // Initial sort order... m_bankListView->sortItems(0, Qt::AscendingOrder); m_progListView->sortItems(0, Qt::AscendingOrder); // UI connections... QObject::connect(m_bankListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(bankChanged())); QObject::connect(m_progListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(progChanged(QTreeWidgetItem*,QTreeWidgetItem*))); QObject::connect(m_progListView, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(accept())); QObject::connect(m_okButton, SIGNAL(clicked()), SLOT(accept())); QObject::connect(m_cancelButton, SIGNAL(clicked()), SLOT(reject())); }
// Constructor. qtractorFileListView::qtractorFileListView ( qtractorFileList::Type iFileType, QWidget *pParent ) : QTreeWidget(pParent), m_iFileType(iFileType) { m_pAutoOpenTimer = NULL; m_iAutoOpenTimeout = 0; m_pDragItem = NULL; m_pDropItem = NULL; m_pRubberBand = NULL; QTreeWidget::setRootIsDecorated(false); QTreeWidget::setUniformRowHeights(true); QTreeWidget::setAlternatingRowColors(true); // QTreeWidget::setDragEnabled(true); QTreeWidget::setAcceptDrops(true); QTreeWidget::setDropIndicatorShown(true); QTreeWidget::setAutoScroll(true); QTreeWidget::setSelectionMode(QAbstractItemView::ExtendedSelection); QTreeWidget::setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); QTreeWidget::setSortingEnabled(false); QHeaderView *pHeader = QTreeWidget::header(); pHeader->setDefaultAlignment(Qt::AlignLeft); // pHeader->setDefaultSectionSize(160); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setMovable(false); #endif pHeader->setStretchLastSection(true); // Trap for help/tool-tips events. QTreeWidget::viewport()->installEventFilter(this); setAutoOpenTimeout(800); QObject::connect(this, SIGNAL(itemClicked(QTreeWidgetItem*,int)), SLOT(itemClickedSlot(QTreeWidgetItem*))); QObject::connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(itemActivatedSlot(QTreeWidgetItem*))); // QObject::connect(this, // SIGNAL(itemActivated(QTreeWidgetItem*,int)), // SLOT(itemActivatedSlot(QTreeWidgetItem*))); QObject::connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemExpandedSlot(QTreeWidgetItem*))); QObject::connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemCollapsedSlot(QTreeWidgetItem*))); QObject::connect(QTreeWidget::itemDelegate(), SIGNAL(commitData(QWidget*)), SLOT(itemRenamedSlot())); }
BoardView::BoardView(QWidget *parent) :QTableView(parent) { QHeaderView *hHeader = horizontalHeader(); #ifdef HAVE_QT5 hHeader->setSectionResizeMode(QHeaderView::Fixed); hHeader->setSectionsMovable(false); hHeader->setSectionsClickable(false); #else hHeader->setMovable(false); hHeader->setResizeMode(QHeaderView::Fixed); hHeader->setClickable(false); #endif hHeader->setDefaultAlignment( Qt::AlignHCenter ); hHeader->setDefaultSectionSize(50); QHeaderView *vHeader = verticalHeader(); #ifdef HAVE_QT5 vHeader->setSectionResizeMode(QHeaderView::Fixed); vHeader->setSectionsClickable(false); vHeader->setSectionsMovable(false); #else vHeader->setResizeMode(QHeaderView::Fixed); vHeader->setClickable(false); vHeader->setMovable(false); #endif vHeader->setDefaultAlignment( Qt::AlignVCenter ); vHeader->setDefaultSectionSize(50); setSelectionMode(QAbstractItemView::SingleSelection); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setItemDelegate(new BoardDelegate(this)); setStyleSheet("QHeaderView::section {background-color: #ffffe7; border: 1px solid #74440e; color: black; }" "QTableCornerButton::section { background-color: #ffffe7; border: 1px solid #74440e; color: black; }" "QToolTip { background-color: #ffeeaf; padding: 2px; border: 1px solid #74440e; }"); }
void DlgInspector::setNode(SoNode* node) { SceneModel* model = static_cast<SceneModel*>(ui->treeView->model()); model->setNode(node); QHeaderView* header = ui->treeView->header(); #if QT_VERSION >= 0x050000 header->setSectionResizeMode(0, QHeaderView::Stretch); header->setSectionsMovable(false); #else header->setResizeMode(0, QHeaderView::Stretch); header->setMovable(false); #endif }
AccountPanelImpl::AccountPanelImpl(QWidget *parent) : QDialog(parent) { setupUi(this); reload_ui(); QHeaderView *h = list_curency->header(); h->setSectionResizeMode(QHeaderView::ResizeToContents); h->setSectionsMovable(false); list_curency->setDragEnabled(false); QDoubleValidator *dv = new QDoubleValidator(0.00, 9999999999.99, 2, this); eUnit1->setValidator(dv); eUnit2->setReadOnly(true); init_connections(); }
Prefs_Fonts::Prefs_Fonts(QWidget* parent, ScribusDoc* doc) : Prefs_Pane(parent), m_doc(doc) { setupUi(this); RList = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub; UsedFonts.clear(); CurrentPath = ""; m_askBeforeSubstitute = true; setMinimumSize(fontMetrics().width( tr( "Available Fonts" )+ tr( "Font Substitutions" )+ tr( "Additional Paths" ))+180, 200); fontListTableView->setModel(new FontListModel(fontListTableView, m_doc)); fontSubstitutionsTableWidget->setRowCount(RList.count()); fontSubstitutionsTableWidget->setColumnCount(2); fontSubstitutionsTableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem( tr("Font Name"))); fontSubstitutionsTableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem( tr("Replacement"))); fontSubstitutionsTableWidget->setSortingEnabled(false); fontSubstitutionsTableWidget->setSelectionBehavior( QAbstractItemView::SelectRows ); QHeaderView *header = fontSubstitutionsTableWidget->horizontalHeader(); header->setSectionsMovable(false); header->setSectionsClickable(false); header->setSectionResizeMode(QHeaderView::Stretch); fontSubstitutionsTableWidget->verticalHeader()->hide(); fontSubstitutionsTableWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); // If we're being called for global application preferences, not document // preferences, we let the user customize font search paths. Because things // go rather badly if paths are changed/removed while a doc is open, the // control is also not displayed if there is a document open. if (m_doc==0 && !ScCore->primaryMainWindow()->HaveDoc) { whyBlankLabel->resize(0,0); whyBlankLabel->hide(); readPaths(); changeButton->setEnabled(false); removeButton->setEnabled(false); connect(pathListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(SelectPath(QListWidgetItem*))); connect(addButton, SIGNAL(clicked()), this, SLOT(AddPath())); connect(changeButton, SIGNAL(clicked()), this, SLOT(ChangePath())); connect(removeButton, SIGNAL(clicked()), this, SLOT(DelPath())); }
// Settlers. void qtractorMidiEventListView::setEditor ( qtractorMidiEditor *pEditor ) { if (m_pItemDelegate) delete m_pItemDelegate; if (m_pListModel) delete m_pListModel; m_pListModel = new qtractorMidiEventListModel(pEditor); m_pItemDelegate = new qtractorMidiEventItemDelegate(); QTreeView::setModel(m_pListModel); QTreeView::setItemDelegate(m_pItemDelegate); QTreeView::setSelectionMode(QAbstractItemView::ExtendedSelection); QTreeView::setRootIsDecorated(false); QTreeView::setUniformRowHeights(true); QTreeView::setItemsExpandable(false); QTreeView::setAllColumnsShowFocus(true); QTreeView::setAlternatingRowColors(true); QHeaderView *pHeader = QTreeView::header(); // pHeader->setDefaultAlignment(Qt::AlignLeft); pHeader->setDefaultSectionSize(80); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif pHeader->resizeSection(2, 60); // Name pHeader->resizeSection(3, 40); // Value pHeader->setStretchLastSection(true); }
// Constructor. qjackctlClientListView::qjackctlClientListView ( qjackctlConnectView *pConnectView, bool bReadable ) : QTreeWidget(pConnectView) { m_pConnectView = pConnectView; m_pAutoOpenTimer = 0; m_iAutoOpenTimeout = 0; m_pDragItem = NULL; m_pDragItem = NULL; m_pAliases = NULL; m_bRenameEnabled = false; QHeaderView *pHeader = QTreeWidget::header(); pHeader->setDefaultAlignment(Qt::AlignLeft); // pHeader->setDefaultSectionSize(120); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionsMovable(false); pHeader->setSectionsClickable(true); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setMovable(false); pHeader->setClickable(true); #endif pHeader->setSortIndicatorShown(true); pHeader->setStretchLastSection(true); QTreeWidget::setRootIsDecorated(true); QTreeWidget::setUniformRowHeights(true); // QTreeWidget::setDragEnabled(true); QTreeWidget::setAcceptDrops(true); QTreeWidget::setDropIndicatorShown(true); QTreeWidget::setAutoScroll(true); QTreeWidget::setSelectionMode(QAbstractItemView::SingleSelection); QTreeWidget::setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); QTreeWidget::setSortingEnabled(true); QTreeWidget::setMinimumWidth(120); QTreeWidget::setColumnCount(1); QString sText; if (bReadable) sText = tr("Readable Clients / Output Ports"); else sText = tr("Writable Clients / Input Ports"); QTreeWidget::headerItem()->setText(0, sText); QTreeWidget::sortItems(0, Qt::AscendingOrder); QTreeWidget::setToolTip(sText); // Trap for help/tool-tips events. QTreeWidget::viewport()->installEventFilter(this); QObject::connect(QTreeWidget::itemDelegate(), SIGNAL(commitData(QWidget*)), SLOT(renamedSlot())); setAutoOpenTimeout(800); }
ExtImageProps::ExtImageProps( QWidget* parent, ImageInfoRecord *info, PageItem *item, ScribusView *view ) : QDialog( parent ) { setModal(true); setWindowTitle( tr( "Extended Image Properties" ) ); setWindowIcon(IconManager::instance()->loadIcon("AppIcon.png")); ExtImagePropsLayout = new QVBoxLayout( this ); ExtImagePropsLayout->setMargin(6); ExtImagePropsLayout->setSpacing(6); m_view = view; m_timer = 0; if (info->layerInfo.count() != 0) { m_timer = new QTimer(this); m_timer->setSingleShot(true); m_timer->setInterval(350); } m_item = item; currentLayer = 0; originalInfo = *info; originalImageClip = item->imageClip.copy(); blendModes.clear(); blendModes.insert("norm", tr("Normal")); blendModes.insert("dark", tr("Darken")); blendModes.insert("lite", tr("Lighten")); blendModes.insert("hue ", tr("Hue")); blendModes.insert("sat ", tr("Saturation")); blendModes.insert("colr", tr("Color")); blendModes.insert("lum ", tr("Luminosity")); blendModes.insert("mul ", tr("Multiply")); blendModes.insert("scrn", tr("Screen")); blendModes.insert("diss", tr("Dissolve")); blendModes.insert("over", tr("Overlay")); blendModes.insert("hLit", tr("Hard Light")); blendModes.insert("sLit", tr("Soft Light")); blendModes.insert("diff", tr("Difference")); blendModes.insert("smud", tr("Exclusion")); blendModes.insert("div ", tr("Color Dodge")); blendModes.insert("idiv", tr("Color Burn")); blendModes.insert("plus", tr("Plus")); blendModes.insert("dsti", tr("Destination In")); blendModes.insert("dsto", tr("Destination Out")); blendModesRev.clear(); blendModesRev.insert( tr("Normal"), "norm"); blendModesRev.insert( tr("Darken"), "dark"); blendModesRev.insert( tr("Lighten"), "lite"); blendModesRev.insert( tr("Hue"), "hue "); blendModesRev.insert( tr("Saturation"), "sat "); blendModesRev.insert( tr("Color"), "colr"); blendModesRev.insert( tr("Luminosity"), "lum "); blendModesRev.insert( tr("Multiply"), "mul "); blendModesRev.insert( tr("Screen"), "scrn"); blendModesRev.insert( tr("Dissolve"), "diss"); blendModesRev.insert( tr("Overlay"), "over"); blendModesRev.insert( tr("Hard Light"), "hLit"); blendModesRev.insert( tr("Soft Light"), "sLit"); blendModesRev.insert( tr("Difference"), "diff"); blendModesRev.insert( tr("Exclusion"), "smud"); blendModesRev.insert( tr("Color Dodge"), "div "); blendModesRev.insert( tr("Color Burn"), "idiv"); blendModesRev.insert( tr("Plus"), "plus"); blendModesRev.insert( tr("Destination In"), "dsti"); blendModesRev.insert( tr("Destination Out"), "dsto"); propsTab = new QTabWidget( this ); QPalette palette; palette.setColor(backgroundRole(), Qt::white); if (info->layerInfo.count() != 0) { tab = new QWidget( propsTab ); tabLayout = new QVBoxLayout( tab ); tabLayout->setMargin(6); tabLayout->setSpacing(6); layout1 = new QHBoxLayout; layout1->setMargin(0); layout1->setSpacing(6); textLabel1 = new QLabel( tab ); textLabel1->setText( tr( "Blend Mode:" ) ); layout1->addWidget( textLabel1 ); blendMode = new ScComboBox( tab ); blendMode->clear(); blendMode->addItem( tr("Normal")); blendMode->addItem( tr("Darken")); blendMode->addItem( tr("Lighten")); blendMode->addItem( tr("Hue")); blendMode->addItem( tr("Saturation")); blendMode->addItem( tr("Color")); blendMode->addItem( tr("Luminosity")); blendMode->addItem( tr("Multiply")); blendMode->addItem( tr("Screen")); blendMode->addItem( tr("Dissolve")); blendMode->addItem( tr("Overlay")); blendMode->addItem( tr("Hard Light")); blendMode->addItem( tr("Soft Light")); blendMode->addItem( tr("Difference")); blendMode->addItem( tr("Exclusion")); blendMode->addItem( tr("Color Dodge")); blendMode->addItem( tr("Color Burn")); blendMode->addItem( tr("Plus")); blendMode->addItem( tr("Destination In")); blendMode->addItem( tr("Destination Out")); layout1->addWidget( blendMode ); textLabel2 = new QLabel( tab ); textLabel2->setText( tr( "Opacity:" ) ); layout1->addWidget( textLabel2 ); opacitySpinBox = new ScrSpinBox( tab ); opacitySpinBox->setMinimum(0); opacitySpinBox->setDecimals(0); opacitySpinBox->setMaximum(100); opacitySpinBox->setSingleStep(10); opacitySpinBox->setSuffix( tr(" %")); layout1->addWidget( opacitySpinBox ); tabLayout->addLayout( layout1 ); layerTable = new QTableWidget(info->layerInfo.count(), 3, tab ); layerTable->setHorizontalHeaderItem(0, new QTableWidgetItem(IconManager::instance()->loadIcon("16/show-object.png"), "")); layerTable->setHorizontalHeaderItem(1, new QTableWidgetItem("")); layerTable->setHorizontalHeaderItem(2, new QTableWidgetItem( tr("Name"))); QHeaderView* headerH = layerTable->horizontalHeader(); headerH->setStretchLastSection(true); headerH->setSectionsClickable(false ); headerH->setSectionsMovable( false ); if (info->layerInfo.count() == 1) { layerTable->setColumnWidth(1, 40); layerTable->setColumnWidth(0, 24); } layerTable->setSortingEnabled(false); layerTable->setSelectionBehavior(QTableWidget::SelectRows); QHeaderView *Header = layerTable->verticalHeader(); Header->setSectionsMovable( false ); Header->setSectionResizeMode(QHeaderView::Fixed); Header->hide(); FlagsSicht.clear(); int col2Width = 0; int col1Width = 0; if ((info->isRequest) && (info->RequestProps.contains(0))) { opacitySpinBox->setValue(qRound(info->RequestProps[0].opacity / 255.0 * 100)); setCurrentComboItem(blendMode, blendModes[info->RequestProps[0].blend]); } else { opacitySpinBox->setValue(qRound(info->layerInfo[0].opacity / 255.0 * 100)); setCurrentComboItem(blendMode, blendModes[info->layerInfo[0].blend]); } opacitySpinBox->setEnabled(true); blendMode->setEnabled(true); QString tmp; QList<PSDLayer>::iterator it2; uint counter = 0; for (it2 = info->layerInfo.begin(); it2 != info->layerInfo.end(); ++it2) { QCheckBox *cp = new QCheckBox(it2->layerName, this); cp->setPalette(palette); QPixmap pm; pm=QPixmap::fromImage(it2->thumb); col1Width = qMax(col1Width, pm.width()); cp->setIcon(pm); FlagsSicht.append(cp); connect(cp, SIGNAL(clicked()), this, SLOT(changedLayer())); layerTable->setCellWidget(info->layerInfo.count()-counter-1, 0, cp); if ((info->isRequest) && (info->RequestProps.contains(counter))) cp->setChecked(info->RequestProps[counter].visible); else cp->setChecked(!(it2->flags & 2)); if (!it2->thumb_mask.isNull()) { QCheckBox *cp2 = new QCheckBox(it2->layerName, this); cp2->setPalette(palette); QPixmap pm2; pm2=QPixmap::fromImage(it2->thumb_mask); col2Width = qMax(col2Width, pm2.width()); cp2->setIcon(pm2); connect(cp2, SIGNAL(clicked()), this, SLOT(changedLayer())); layerTable->setCellWidget(info->layerInfo.count()-counter-1, 1, cp2); if ((info->isRequest) && (info->RequestProps.contains(counter))) cp2->setChecked(info->RequestProps[counter].useMask); else cp2->setChecked(true); FlagsMask.append(cp2); } else FlagsMask.append(0); QTableWidgetItem *tW = new QTableWidgetItem(it2->layerName); tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW); layerTable->setRowHeight(info->layerInfo.count()-counter-1, 40); counter++; } tabLayout->addWidget( layerTable ); layerTable->setColumnWidth(1, 24 + col2Width); layerTable->setColumnWidth(0, 24 + col1Width); blendMode->setCurrentIndex(0); // headerH->setResizeMode(QHeaderView::Fixed); propsTab->addTab( tab, tr( "Layers" ) ); } tab_2 = new QWidget( propsTab ); tabLayout_2 = new QVBoxLayout( tab_2 ); tabLayout_2->setMargin(6); tabLayout_2->setSpacing(6); pathList = new QListWidget( tab_2 ); pathList->clear(); pathList->setIconSize(QSize(40, 40)); QMap<QString, FPointArray>::Iterator it; if (info->PDSpathData.count() != 0) { for (it = info->PDSpathData.begin(); it != info->PDSpathData.end(); ++it) { QImage pixm(40, 40, QImage::Format_ARGB32_Premultiplied); ScPainter *p = new ScPainter(&pixm, 40, 40); p->clear(); p->translate(3.0, 3.0); if (it.key() == info->clipPath) { pixm.fill(Qt::green); p->clear(Qt::green); } else pixm.fill(Qt::white); FPointArray Path; Path.resize(0); Path = info->PDSpathData[it.key()].copy(); FPoint min = getMinClipF(&Path); Path.translate(-min.x(), -min.y()); FPoint max = Path.WidthHeight(); QTransform mm; mm.scale(34.0 / qMax(max.x(), max.y()), 34.0 / qMax(max.x(), max.y())); Path.map(mm); p->setupPolygon(&Path); p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); p->setBrush(Qt::white); p->setFillMode(ScPainter::None); p->setStrokeMode(ScPainter::Solid); p->strokePath(); p->end(); delete p; QPixmap pm; pm=QPixmap::fromImage(pixm); new QListWidgetItem(QIcon(pm), it.key(), pathList); if (it.key() == info->usedPath) { pathList->setCurrentRow(pathList->count()-1); pathList->currentItem()->setSelected(true); } } } tabLayout_2->addWidget( pathList ); resetPath = new QPushButton( tr("Don't use any Path"), tab_2); tabLayout_2->addWidget( resetPath ); propsTab->addTab( tab_2, tr( "Paths" ) ); ExtImagePropsLayout->addWidget( propsTab ); layoutBottom = new QHBoxLayout; layoutBottom->setMargin(0); layoutBottom->setSpacing(6); livePreview = new QCheckBox( this ); livePreview->setText( tr( "Live Preview" ) ); livePreview->setChecked(true); doPreview = true; layoutBottom->addWidget( livePreview ); QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); layoutBottom->addItem( spacer ); okButton = new QPushButton( CommonStrings::tr_OK, this ); layoutBottom->addWidget( okButton ); cancelButton = new QPushButton( CommonStrings::tr_Cancel, this ); cancelButton->setDefault( true ); layoutBottom->addWidget( cancelButton ); ExtImagePropsLayout->addLayout( layoutBottom ); resize(330, 320); connect(pathList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( selPath(QListWidgetItem*) ) ); connect(resetPath, SIGNAL(clicked()), this, SLOT(noPath())); connect(livePreview, SIGNAL(clicked()), this, SLOT(changePreview())); connect(okButton, SIGNAL(clicked()), this, SLOT(leaveOK())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(leaveCancel())); if (info->layerInfo.count() != 0) { layerTable->selectionModel()->clearSelection(); opacitySpinBox->setEnabled(false); blendMode->setEnabled(false); connect(m_timer, SIGNAL(timeout()), this, SLOT(changedLayer())); connect(layerTable, SIGNAL(itemSelectionChanged()), this, SLOT(selLayer())); connect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(delayedLayerChange())); connect(blendMode, SIGNAL(activated(int)), this, SLOT(changedLayer())); }
// Constructor. qtractorBusForm::qtractorBusForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); // Initialize locals. m_pBus = NULL; m_pAudioRoot = NULL; m_pMidiRoot = NULL; m_iDirtySetup = 0; m_iDirtyCount = 0; m_iDirtyTotal = 0; QHeaderView *pHeader = m_ui.BusListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); pHeader->resizeSection(0, 140); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(1, QHeaderView::ResizeToContents); pHeader->setSectionResizeMode(2, QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(1, QHeaderView::ResizeToContents); pHeader->setResizeMode(2, QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif m_ui.BusListView->setContextMenuPolicy(Qt::CustomContextMenu); const QColor& rgbDark = palette().dark().color().darker(150); m_ui.BusTitleTextLabel->setPalette(QPalette(rgbDark)); m_ui.BusTitleTextLabel->setAutoFillBackground(true); // (Re)initial contents. refreshBuses(); // Try to restore normal window positioning. adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.BusListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(selectBus())); QObject::connect(m_ui.BusListView, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&))); QObject::connect(m_ui.BusNameLineEdit, SIGNAL(textChanged(const QString&)), SLOT(changed())); QObject::connect(m_ui.BusModeComboBox, SIGNAL(activated(int)), SLOT(changed())); QObject::connect(m_ui.MonitorCheckBox, SIGNAL(clicked()), SLOT(changed())); QObject::connect(m_ui.AudioChannelsSpinBox, SIGNAL(valueChanged(int)), SLOT(changed())); QObject::connect(m_ui.AudioAutoConnectCheckBox, SIGNAL(clicked()), SLOT(changed())); QObject::connect(m_ui.MidiInstrumentComboBox, SIGNAL(activated(int)), SLOT(changed())); QObject::connect(m_ui.MidiSysexPushButton, SIGNAL(clicked()), SLOT(midiSysex())); QObject::connect(m_ui.InputPluginListView, SIGNAL(currentRowChanged(int)), SLOT(stabilizeForm())); QObject::connect(m_ui.InputPluginListView, SIGNAL(contentsChanged()), SLOT(stabilizeForm())); QObject::connect(m_ui.AddInputPluginToolButton, SIGNAL(clicked()), SLOT(addInputPlugin())); QObject::connect(m_ui.RemoveInputPluginToolButton, SIGNAL(clicked()), SLOT(removeInputPlugin())); QObject::connect(m_ui.MoveUpInputPluginToolButton, SIGNAL(clicked()), SLOT(moveUpInputPlugin())); QObject::connect(m_ui.MoveDownInputPluginToolButton, SIGNAL(clicked()), SLOT(moveDownInputPlugin())); QObject::connect(m_ui.OutputPluginListView, SIGNAL(currentRowChanged(int)), SLOT(stabilizeForm())); QObject::connect(m_ui.OutputPluginListView, SIGNAL(contentsChanged()), SLOT(stabilizeForm())); QObject::connect(m_ui.AddOutputPluginToolButton, SIGNAL(clicked()), SLOT(addOutputPlugin())); QObject::connect(m_ui.RemoveOutputPluginToolButton, SIGNAL(clicked()), SLOT(removeOutputPlugin())); QObject::connect(m_ui.MoveUpOutputPluginToolButton, SIGNAL(clicked()), SLOT(moveUpOutputPlugin())); QObject::connect(m_ui.MoveDownOutputPluginToolButton, SIGNAL(clicked()), SLOT(moveDownOutputPlugin())); QObject::connect(m_ui.MoveUpPushButton, SIGNAL(clicked()), SLOT(moveUpBus())); QObject::connect(m_ui.MoveDownPushButton, SIGNAL(clicked()), SLOT(moveDownBus())); QObject::connect(m_ui.CreatePushButton, SIGNAL(clicked()), SLOT(createBus())); QObject::connect(m_ui.UpdatePushButton, SIGNAL(clicked()), SLOT(updateBus())); QObject::connect(m_ui.DeletePushButton, SIGNAL(clicked()), SLOT(deleteBus())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); stabilizeForm(); }
// Constructor. qtractorPluginSelectForm::qtractorPluginSelectForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); m_pPluginList = NULL; // Populate plugin type hints... m_ui.PluginTypeComboBox->addItem( qtractorPluginType::textFromHint(qtractorPluginType::Any)); #ifdef CONFIG_LADSPA m_ui.PluginTypeComboBox->addItem( qtractorPluginType::textFromHint(qtractorPluginType::Ladspa)); #endif #ifdef CONFIG_DSSI m_ui.PluginTypeComboBox->addItem( qtractorPluginType::textFromHint(qtractorPluginType::Dssi)); #endif #ifdef CONFIG_VST m_ui.PluginTypeComboBox->addItem( qtractorPluginType::textFromHint(qtractorPluginType::Vst)); #endif #ifdef CONFIG_LV2 m_ui.PluginTypeComboBox->addItem( qtractorPluginType::textFromHint(qtractorPluginType::Lv2)); #endif QHeaderView *pHeader = m_ui.PluginListView->header(); // pHeader->setDefaultSectionSize(240); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setMovable(false); #endif pHeader->setStretchLastSection(true); QTreeWidgetItem *pHeaderItem = m_ui.PluginListView->headerItem(); pHeaderItem->setTextAlignment(0, Qt::AlignLeft); // Name. pHeaderItem->setTextAlignment(5, Qt::AlignLeft); // Filename. pHeaderItem->setTextAlignment(6, Qt::AlignLeft); // Index. pHeaderItem->setTextAlignment(7, Qt::AlignLeft); // Instances. pHeaderItem->setTextAlignment(8, Qt::AlignLeft); // Type. pHeader->resizeSection(0, 240); // Name. m_ui.PluginListView->resizeColumnToContents(1); // Audio. m_ui.PluginListView->resizeColumnToContents(2); // MIDI. m_ui.PluginListView->resizeColumnToContents(3); // Controls. m_ui.PluginListView->resizeColumnToContents(4); // Modes. pHeader->resizeSection(5, 120); // Path. m_ui.PluginListView->resizeColumnToContents(6); // Index m_ui.PluginListView->resizeColumnToContents(7); // Instances m_ui.PluginListView->setSortingEnabled(true); m_ui.PluginListView->sortItems(0, Qt::AscendingOrder); m_ui.PluginScanProgressBar->setMaximum(100); m_ui.PluginScanProgressBar->hide(); // Initialize conveniency options... qtractorOptions *pOptions = qtractorOptions::getInstance(); if (pOptions) { pOptions->loadComboBoxHistory(m_ui.PluginSearchComboBox); m_ui.PluginSearchComboBox->setEditText( pOptions->sPluginSearch); m_ui.PluginTypeComboBox->setCurrentIndex(pOptions->iPluginType); m_ui.PluginActivateCheckBox->setChecked(pOptions->bPluginActivate); } // Let the search begin... m_ui.PluginSearchComboBox->setFocus(); adjustSize(); // Restore last seen dialog position and extent... if (pOptions) pOptions->loadWidgetGeometry(this, true); // UI signal/slot connections... QObject::connect(m_ui.PluginResetToolButton, SIGNAL(clicked()), SLOT(reset())); QObject::connect(m_ui.PluginSearchComboBox, SIGNAL(editTextChanged(const QString&)), SLOT(refresh())); QObject::connect(m_ui.PluginTypeComboBox, SIGNAL(activated(int)), SLOT(typeHintChanged(int))); QObject::connect(m_ui.PluginListView, SIGNAL(itemSelectionChanged()), SLOT(stabilize())); // QObject::connect(m_ui.PluginListView, // SIGNAL(itemActivated(QTreeWidgetItem *, int)), // SLOT(accept())); QObject::connect(m_ui.PluginListView, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), SLOT(accept())); QObject::connect(m_ui.PluginActivateCheckBox, SIGNAL(clicked()), SLOT(stabilize())); QObject::connect(m_ui.PluginRescanPushButton, SIGNAL(clicked()), SLOT(rescan())); QObject::connect(m_ui.DialogButtonBox, SIGNAL(accepted()), SLOT(accept())); QObject::connect(m_ui.DialogButtonBox, SIGNAL(rejected()), SLOT(reject())); qtractorPluginFactory *pPluginFactory = qtractorPluginFactory::getInstance(); if (pPluginFactory) { QObject::connect(pPluginFactory, SIGNAL(scanned(int)), SLOT(scanned(int))); } typeHintChanged(m_ui.PluginTypeComboBox->currentIndex()); }
void ResTable::init() { if (!(m_model = new RecollModel(prefs.restableFields))) return; tableView->setModel(m_model); tableView->setMouseTracking(true); tableView->setSelectionBehavior(QAbstractItemView::SelectRows); tableView->setItemDelegate(new ResTableDelegate(this)); tableView->setContextMenuPolicy(Qt::CustomContextMenu); new QShortcut(QKeySequence("Ctrl+o"), this, SLOT(menuEdit())); new QShortcut(QKeySequence("Ctrl+Shift+o"), this, SLOT(menuEditAndQuit())); new QShortcut(QKeySequence("Ctrl+d"), this, SLOT(menuPreview())); connect(tableView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(createPopupMenu(const QPoint&))); QHeaderView *header = tableView->horizontalHeader(); if (header) { if (int(prefs.restableColWidths.size()) == header->count()) { for (int i = 0; i < header->count(); i++) { header->resizeSection(i, prefs.restableColWidths[i]); } } header->setSortIndicatorShown(true); header->setSortIndicator(-1, Qt::AscendingOrder); header->setContextMenuPolicy(Qt::CustomContextMenu); header->setStretchLastSection(1); connect(header, SIGNAL(sectionResized(int,int,int)), this, SLOT(saveColState())); connect(header, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(createHeaderPopupMenu(const QPoint&))); } #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) header->setSectionsMovable(true); #else header->setMovable(true); #endif header = tableView->verticalHeader(); if (header) { header->setDefaultSectionSize(QApplication::fontMetrics().height() + ROWHEIGHTPAD); } QKeySequence seq("Esc"); QShortcut *sc = new QShortcut(seq, this); connect(sc, SIGNAL (activated()), tableView->selectionModel(), SLOT (clear())); connect(tableView->selectionModel(), SIGNAL(currentChanged(const QModelIndex&, const QModelIndex &)), this, SLOT(onTableView_currentChanged(const QModelIndex&))); connect(tableView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(onDoubleClick(const QModelIndex&))); m_pager = new ResTablePager(this); QSettings settings; QVariant saved = settings.value("resTableSplitterSizes"); if (saved != QVariant()) { splitter->restoreState(saved.toByteArray()); } else { QList<int> sizes; sizes << 355 << 125; splitter->setSizes(sizes); } delete textBrowser; m_detail = new ResTableDetailArea(this); m_detail->setReadOnly(true); m_detail->setUndoRedoEnabled(false); m_detail->setOpenLinks(false); // signals and slots connections connect(m_detail, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(linkWasClicked(const QUrl &))); splitter->addWidget(m_detail); splitter->setOrientation(Qt::Vertical); }
FontReplaceDialog::FontReplaceDialog( QWidget* parent, QMap<QString, QString> *RList) : QDialog( parent ) { setModal(true); setWindowTitle( tr( "Font Substitution" ) ); setWindowIcon(IconManager::instance()->loadIcon("AppIcon.png")); ReplaceList = RList; FontReplaceDialogLayout = new QVBoxLayout( this ); FontReplaceDialogLayout->setMargin(10); FontReplaceDialogLayout->setSpacing(5); textLabel1 = new QLabel(this); textLabel1->setAlignment(Qt::AlignVCenter); textLabel1->setWordWrap(true); textLabel1->setText( "<qt>" + tr("This document contains some fonts that are not installed on your system, please choose a suitable replacement for them. Cancel will stop the document from loading.") + "</qt>" ); FontReplaceDialogLayout->addWidget( textLabel1 ); replacementTable = new QTableWidget(0, 2, this ); replacementTable->setHorizontalHeaderItem(0, new QTableWidgetItem( tr("Original Font"))); replacementTable->setHorizontalHeaderItem(1, new QTableWidgetItem( tr("Substitution Font"))); replacementTable->setSortingEnabled(false); replacementTable->setSelectionBehavior( QAbstractItemView::SelectRows ); QHeaderView *header = replacementTable->horizontalHeader(); header->setSectionsClickable(false ); header->setSectionsMovable( false ); header->setSectionResizeMode(QHeaderView::Stretch); replacementTable->verticalHeader()->hide(); replacementTable->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); replacementTable->setRowCount(RList->count()); int a = 0; QMap<QString,QString>::Iterator itfsu; for (itfsu = RList->begin(); itfsu != RList->end(); ++itfsu) { replacementTable->setItem(a, 0, new QTableWidgetItem(itfsu.key())); FontCombo* item = new FontCombo(this); setCurrentComboItem(item, itfsu.value()); replacementTable->setCellWidget(a, 1, item); a++; } FontReplaceDialogLayout->addWidget( replacementTable ); layout1 = new QHBoxLayout; layout1->setMargin(0); layout1->setSpacing(5); stickyReplacements = new QCheckBox( this ); stickyReplacements->setText( tr( "Make these substitutions permanent" ) ); layout1->addWidget( stickyReplacements ); QSpacerItem* spacer1 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout1->addItem( spacer1 ); okButton = new QPushButton( CommonStrings::tr_OK, this ); layout1->addWidget( okButton ); cancelButton = new QPushButton( CommonStrings::tr_Cancel, this ); layout1->addWidget( cancelButton ); FontReplaceDialogLayout->addLayout( layout1 ); resize( QSize(450, 250) ); cancelButton->setToolTip( "<qt>" + tr( "Cancels these font substitutions and stops loading the document.") + "</qt>" ); stickyReplacements->setToolTip( "<qt>" + tr( "Enabling this tells Scribus to use these replacements for missing fonts permanently in all future layouts. This can be reverted or changed in File > Preferences > Fonts.") + "</qt>" ); okButton->setToolTip( "<qt>" + tr( "If you select OK, then save, these substitutions are made permanent in the document.") + "</qt>" ); connect(okButton, SIGNAL(clicked()), this, SLOT(leaveOK())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); }
DlRawfileDescTab::DlRawfileDescTab(QWidget* parent, DlProject* dlProject) : QWidget(parent), dlProject_(dlProject), rawSettingsDialog(nullptr), fieldSepTOB1Flag_(false) { DEBUG_FUNC_NAME variableView_ = new VariableView(this); variableModel_ = new VariableModel(variableView_, dlProject_->variables()); variableDelegate_ = new VariableDelegate(variableView_); variableView_->setModel(variableModel_); variableView_->setItemDelegate(variableDelegate_); variableView_->setSelectionMode(QAbstractItemView::SingleSelection); variableView_->setSelectionBehavior(QAbstractItemView::SelectColumns); variableView_->setCornerButtonEnabled(false); variableView_->setWordWrap(false); QHeaderView *hHeaderView = variableView_->horizontalHeader(); hHeaderView->setDefaultSectionSize(175); hHeaderView->setSectionResizeMode(QHeaderView::Fixed); hHeaderView->setSectionsClickable(true); hHeaderView->setHighlightSections(true); hHeaderView->setSectionsMovable(false); variableView_->setMinimumHeight(298); variableView_->resizeRowsToContents(); variableView_->resizeColumnsToContents(); for (int i = 0; i < variableModel_->rowCount(); i++) { variableView_->verticalHeader()->resizeSection(i, 20); } auto addButton = new QToolButton; addButton->setObjectName(QStringLiteral("plusButton")); addButton->setToolTip(tr("<b>+</b> Add a variable.")); auto removeButton = new QToolButton; removeButton->setObjectName(QStringLiteral("minusButton")); removeButton->setToolTip(tr("<b>-</b> Remove a variable.")); auto buttonsLayout = new QVBoxLayout; buttonsLayout->addWidget(addButton); buttonsLayout->addWidget(removeButton); buttonsLayout->addStretch(); rawSettingsButton = new QPushButton(tr("Raw File Settings...")); rawSettingsButton->setProperty("mdButton", true); rawSettingsButton->setStyleSheet(QStringLiteral("QPushButton {margin-top: 15px}")); clearCustomVarsButton = new QPushButton(tr("Clear Custom Variables")); clearCustomVarsButton->setProperty("mdButton", true); clearCustomVarsButton->setStyleSheet(QStringLiteral("QPushButton {margin-top: 15px}")); auto varLayout = new QGridLayout; varLayout->addWidget(variableView_, 0, 0, -1, 1); varLayout->addLayout(buttonsLayout, 0, 1, 1, 1); varLayout->setColumnStretch(0, 1); varLayout->setColumnStretch(1, 0); varLayout->setRowStretch(2, 0); varLayout->setSizeConstraint(QLayout::SetNoConstraint); auto varGroup = new QGroupBox(tr("Data Columns Info")); varGroup->setObjectName(QStringLiteral("simpleGroupBox")); varGroup->setFlat(true); varGroup->setLayout(varLayout); auto varScrollArea = new QScrollArea; varScrollArea->setWidget(varGroup); varScrollArea->setWidgetResizable(true); auto mainlayout = new QGridLayout(this); mainlayout->setRowMinimumHeight(0, 18); mainlayout->addWidget(rawSettingsButton, 1, 0, 1, 1, Qt::AlignTop); mainlayout->addWidget(clearCustomVarsButton, 2, 0, 1, 1, Qt::AlignTop); mainlayout->addWidget(varScrollArea, 0, 1, -1, -1); mainlayout->setRowStretch(3, 1); mainlayout->setColumnStretch(1, 1); mainlayout->setSizeConstraint(QLayout::SetNoConstraint); setLayout(mainlayout); connect(variableModel_, &VariableModel::modified, [=]() { dlProject_->setModified(true); }); connect(dlProject, &DlProject::projectModified, this, &DlRawfileDescTab::updateModels); connect(dlProject, &DlProject::projectChanged, this, &DlRawfileDescTab::updateModels); connect(addButton, &QToolButton::clicked, variableView_, &VariableView::addVar); connect(removeButton, &QToolButton::clicked, variableView_, &VariableView::removeVar); connect(rawSettingsButton, &QPushButton::clicked, this, &DlRawfileDescTab::showRawSettingsDialog); connect(clearCustomVarsButton, &QPushButton::clicked,[=]() { variableDelegate_->clearCustomVariableBuffer(); }); // to trigger table editing with single click without altering the // editTriggers property, because that way the column selection // clicking on the header trigger the first cell editor connect(variableView_, SIGNAL(clicked(const QModelIndex &)), variableView_, SLOT(edit(const QModelIndex &))); }
// Constructor. qtractorTimeScaleForm::qtractorTimeScaleForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); // Initialize locals. m_pTimeScale = NULL; m_pTempoTap = new QTime(); m_iTempoTap = 0; m_fTempoTap = 0.0f; m_iDirtySetup = 0; m_iDirtyCount = 0; m_iDirtyTotal = 0; QHeaderView *pHeader = m_ui.TimeScaleListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif m_ui.TimeScaleListView->setItemDelegate( new qtractorTimeScaleItemDelegate(m_ui.TimeScaleListView)); m_ui.TimeScaleListView->setContextMenuPolicy(Qt::CustomContextMenu); // (Re)initial contents. // Default is main session time-scale of course... qtractorSession *pSession = qtractorSession::getInstance(); if (pSession) setTimeScale(pSession->timeScale()); // Try to restore normal window positioning. adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.TimeScaleListView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(selectItem())); QObject::connect(m_ui.TimeScaleListView, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&))); QObject::connect(m_ui.BarSpinBox, SIGNAL(valueChanged(int)), SLOT(barChanged(int))); QObject::connect(m_ui.TimeSpinBox, SIGNAL(valueChanged(unsigned long)), SLOT(timeChanged(unsigned long))); QObject::connect(m_ui.TimeSpinBox, SIGNAL(displayFormatChanged(int)), SLOT(refreshItems())); QObject::connect(m_ui.TempoSpinBox, SIGNAL(valueChanged(float, unsigned short, unsigned short)), SLOT(tempoChanged())); QObject::connect(m_ui.TempoSpinBox, SIGNAL(valueChanged(const QString&)), SLOT(tempoChanged())); QObject::connect(m_ui.TempoTapPushButton, SIGNAL(clicked()), SLOT(tempoTap())); QObject::connect(m_ui.TempoFactorPushButton, SIGNAL(clicked()), SLOT(tempoFactor())); QObject::connect(m_ui.MarkerTextLineEdit, SIGNAL(textChanged(const QString&)), SLOT(changed())); QObject::connect(m_ui.MarkerColorToolButton, SIGNAL(clicked()), SLOT(markerColor())); QObject::connect(m_ui.RefreshPushButton, SIGNAL(clicked()), SLOT(refresh())); QObject::connect(m_ui.AddPushButton, SIGNAL(clicked()), SLOT(addItem())); QObject::connect(m_ui.UpdatePushButton, SIGNAL(clicked()), SLOT(updateItem())); QObject::connect(m_ui.RemovePushButton, SIGNAL(clicked()), SLOT(removeItem())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); stabilizeForm(); }
// Constructor. qtractorMidiControlForm::qtractorMidiControlForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); m_iDirtyCount = 0; m_iDirtyMap = 0; m_iUpdating = 0; QHeaderView *pHeader = m_ui.FilesListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif pHeader = m_ui.ControlMapListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif m_pControlTypeGroup = new qtractorMidiControlTypeGroup(NULL, m_ui.ControlTypeComboBox, m_ui.ParamComboBox, m_ui.ParamTextLabel); m_ui.ControlTypeComboBox->setCurrentIndex(3); // Controller (default). // m_ui.ChannelComboBox->clear(); m_ui.ChannelComboBox->addItem("*"); for (unsigned short iChannel = 0; iChannel < 16; ++iChannel) m_ui.ChannelComboBox->addItem(textFromChannel(iChannel)); const QIcon iconCommand(":/images/itemChannel.png"); // m_ui.CommandComboBox->clear(); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_GAIN)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_PANNING)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_MONITOR)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_RECORD)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_MUTE)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_SOLO)); m_ui.SyncCheckBox->setChecked(qtractorMidiControl::isSync()); stabilizeTypeChange(); refreshFiles(); adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.FilesListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(stabilizeForm())); QObject::connect(m_ui.ControlMapListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(stabilizeForm())); QObject::connect(m_ui.ImportPushButton, SIGNAL(clicked()), SLOT(importSlot())); QObject::connect(m_ui.RemovePushButton, SIGNAL(clicked()), SLOT(removeSlot())); QObject::connect(m_ui.MoveUpPushButton, SIGNAL(clicked()), SLOT(moveUpSlot())); QObject::connect(m_ui.MoveDownPushButton, SIGNAL(clicked()), SLOT(moveDownSlot())); QObject::connect(m_pControlTypeGroup, SIGNAL(controlTypeChanged(int)), SLOT(typeChangedSlot())); QObject::connect(m_pControlTypeGroup, SIGNAL(controlParamChanged(int)), SLOT(keyChangedSlot())); QObject::connect(m_ui.ChannelComboBox, SIGNAL(activated(int)), SLOT(keyChangedSlot())); QObject::connect(m_ui.TrackCheckBox, SIGNAL(toggled(bool)), SLOT(keyChangedSlot())); QObject::connect(m_ui.TrackSpinBox, SIGNAL(valueChanged(int)), SLOT(valueChangedSlot())); QObject::connect(m_ui.CommandComboBox, SIGNAL(activated(int)), SLOT(valueChangedSlot())); QObject::connect(m_ui.FeedbackCheckBox, SIGNAL(toggled(bool)), SLOT(valueChangedSlot())); QObject::connect(m_ui.MapPushButton, SIGNAL(clicked()), SLOT(mapSlot())); QObject::connect(m_ui.UnmapPushButton, SIGNAL(clicked()), SLOT(unmapSlot())); QObject::connect(m_ui.SyncCheckBox, SIGNAL(toggled(bool)), SLOT(syncSlot(bool))); QObject::connect(m_ui.ReloadPushButton, SIGNAL(clicked()), SLOT(reloadSlot())); QObject::connect(m_ui.ExportPushButton, SIGNAL(clicked()), SLOT(exportSlot())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); }
// Constructor. qtractorInstrumentForm::qtractorInstrumentForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); m_pInstruments = NULL; m_iDirtyCount = 0; QHeaderView *pHeader = m_ui.InstrumentsListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif pHeader = m_ui.FilesListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif pHeader = m_ui.NamesListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif qtractorSession *pSession = qtractorSession::getInstance(); if (pSession) setInstruments(pSession->instruments()); adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.FilesListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(stabilizeForm())); QObject::connect(m_ui.NamesListView, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemCollapsed(QTreeWidgetItem*))); QObject::connect(m_ui.NamesListView, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*))); QObject::connect(m_ui.InstrumentsListView, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemCollapsed(QTreeWidgetItem*))); QObject::connect(m_ui.InstrumentsListView, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*))); QObject::connect(m_ui.ImportPushButton, SIGNAL(clicked()), SLOT(importSlot())); QObject::connect(m_ui.RemovePushButton, SIGNAL(clicked()), SLOT(removeSlot())); QObject::connect(m_ui.MoveUpPushButton, SIGNAL(clicked()), SLOT(moveUpSlot())); QObject::connect(m_ui.MoveDownPushButton, SIGNAL(clicked()), SLOT(moveDownSlot())); QObject::connect(m_ui.ReloadPushButton, SIGNAL(clicked()), SLOT(reloadSlot())); QObject::connect(m_ui.ExportPushButton, SIGNAL(clicked()), SLOT(exportSlot())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); }