MenuItemWidget::MenuItemWidget(QString id, QString title, QWidget *parent) : QWidget(parent), itemId(id) //isChildrenCollapsed(false), { this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); mainLayout = new QHBoxLayout; this->setLayout(mainLayout); itemTitleLabel = new QLabel; itemTitleLabel->setText(title); mainLayout->addWidget(itemTitleLabel); #if 0 QWidget *spacerWidget = new QWidget; spacerWidget->setMinimumWidth(10); spacerWidget->setMaximumWidth(10); mainLayout->addWidget(spacerWidget); spacerWidget->setStyleSheet("background:#bbccbb"); QWidget *contentWidget = new QWidget; QVBoxLayout *contentLayout = new QVBoxLayout; contentWidget->setLayout(contentLayout); mainLayout->addWidget(contentWidget); QWidget *childContainerWidget = new QWidget; childLayout = new QVBoxLayout; childContainerWidget->setLayout(childLayout); contentLayout->addWidget(childContainerWidget); spacerWidget->setContentsMargins(0, 0, 0, 0); contentLayout->setContentsMargins(0, 0, 0, 0); contentLayout->setSpacing(0); contentWidget->setContentsMargins(0, 0, 0, 0); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); childLayout->setContentsMargins(0, 0, 0, 0); childLayout->setSpacing(0); childContainerWidget->setContentsMargins(0, 0, 0, 0); this->setContentsMargins(0, 0, 0, 0); #endif /* #if 0 this->setMinimumSize(200, 50); this->setMaximumSize(200, 50); #else this->setMinimumSize(0, 0); this->setMaximumSize(0, 0); #endif */ #if 0 // TEST this->setAttribute(Qt::WA_NoSystemBackground, true); #endif }
void MainWindow::doResize() { QWidget *w = centralWidget(); if (w->layout()==0) return; if (w->width() > w->height()) { w->setContentsMargins((w->width()-w->height())/2,0, (w->width()-w->height())/2,0); } else { w->setContentsMargins(0,(w->height()-w->width())/2, 0,(w->height()-w->width())/2); } }
void KInfoCenter::createMenuFrame() { QWidget *sideFrame = new QWidget(m_splitter); sideFrame->setContentsMargins(0,0,0,0); QVBoxLayout *menuLayout = new QVBoxLayout(sideFrame); menuLayout->setContentsMargins(0, 0, 0, 0); m_searchText = new KLineEdit(sideFrame); m_searchText->setClearButtonShown(true); m_searchText->setClickMessage( i18nc( "Search Bar Click Message", "Search" ) ); m_searchText->setCompletionMode( KCompletion::CompletionPopup ); m_searchText->completionObject()->setIgnoreCase(true); m_searchAction = new KAction(this); m_searchAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)); m_searchAction->setText(i18nc("Kaction search label", "Search Modules")); m_searchAction->setIcon(KIcon("search")); actionCollection()->addAction("search",m_searchAction); m_sideMenu = new SidePanel(sideFrame); m_sideMenu->installEventFilter(this); menuLayout->addWidget(m_searchText); menuLayout->addWidget(m_sideMenu); m_splitter->addWidget(sideFrame); }
QWidget * ExtcapArgumentFileSelection::createEditor(QWidget * parent) { QWidget * fileWidget = new QWidget(parent); QHBoxLayout * editLayout = new QHBoxLayout(); QMargins margins = editLayout->contentsMargins(); editLayout->setContentsMargins(0, 0, 0, margins.bottom()); fileWidget->setContentsMargins(margins.left(), margins.right(), 0, margins.bottom()); QPushButton * button = new QPushButton(UTF8_HORIZONTAL_ELLIPSIS, fileWidget); textBox = new QLineEdit(_default->toString(), parent); textBox->setReadOnly(true); if ( _argument->default_complex != NULL && _argument->arg_type == EXTCAP_ARG_STRING ) textBox->setText(QString().fromUtf8(extcap_complex_get_string(_argument->default_complex))); if ( _argument->tooltip != NULL ) { textBox->setToolTip(QString().fromUtf8(_argument->tooltip)); button->setToolTip(QString().fromUtf8(_argument->tooltip)); } connect(button, SIGNAL(clicked()), (QObject *)this, SLOT(openFileDialog())); editLayout->addWidget(textBox); editLayout->addWidget(button); fileWidget->setLayout(editLayout); return fileWidget; }
QWidget * StitcherWorkspace::createConstraintsTree() { QWidget * top = new QWidget(this); QVBoxLayout * vbox = new QVBoxLayout(top); top->setContentsMargins(0,0,0,0); vbox->setContentsMargins(0,0,0,0); /* need a real QTreeView with a model */ QStandardItemModel * model = new QStandardItemModel; QTreeView *treeView = new QTreeView(top); vbox->addWidget(treeView); constraintsTree = treeView; treeView->setModel(model); initConstraintsTree(); treeView->setAlternatingRowColors(true); treeView->setSelectionMode(QAbstractItemView::SingleSelection); treeView->setSelectionBehavior(QAbstractItemView::SelectRows); treeView->resizeColumnToContents(0); treeView->resizeColumnToContents(1); QHBoxLayout * hbox = new QHBoxLayout(); QPushButton * addConstraint = new QPushButton("Add Constraint",top); QPushButton * delConstraint = new QPushButton("Del Constraint",top); connect(addConstraint,SIGNAL(clicked()),this,SLOT(onAddConstraintClicked())); connect(delConstraint,SIGNAL(clicked()),this,SLOT(onDelConstraintClicked())); hbox->addWidget(addConstraint); hbox->addWidget(delConstraint); vbox->addLayout(hbox); QPushButton * optimizeGeometry = new QPushButton("Optimize Geometry",top); connect(optimizeGeometry,SIGNAL(clicked()),this,SLOT(onOptimizeGeometryClicked())); vbox->addWidget(optimizeGeometry); return top; }
void UISettingsDialog::addItem(const QString &strBigIcon, const QString &strBigIconDisabled, const QString &strSmallIcon, const QString &strSmallIconDisabled, int cId, const QString &strLink, UISettingsPage *pSettingsPage /* = 0 */, int iParentId /* = -1 */) { QWidget *pPage = m_pSelector->addItem(strBigIcon, strBigIconDisabled, strSmallIcon, strSmallIconDisabled, cId, strLink, pSettingsPage, iParentId); if (pPage) { #ifdef Q_WS_MAC /* On OSX we add a stretch to the vertical end to make sure the page is * always top aligned. */ QWidget *pW = new QWidget(); pW->setContentsMargins(0, 0, 0, 0); QVBoxLayout *pBox = new QVBoxLayout(pW); VBoxGlobal::setLayoutMargin(pBox, 0); pBox->addWidget(pPage); pBox->addStretch(0); m_pages[cId] = m_pStack->addWidget(pW); #else /* Q_WS_MAC */ m_pages[cId] = m_pStack->addWidget(pPage); #endif /* !Q_WS_MAC */ /* Update process bar: */ m_pProcessBar->setMinimum(0); m_pProcessBar->setMaximum(m_pStack->count()); } if (pSettingsPage) assignValidator(pSettingsPage); }
void TomahawkWindow::setupSideBar() { // Delete fake designer widgets delete ui->sidebarWidget; delete ui->playlistWidget; QWidget* sidebarWidget = new QWidget(); sidebarWidget->setLayout( new QVBoxLayout() ); m_sidebar = new AnimatedSplitter(); m_sidebar->setOrientation( Qt::Vertical ); m_sidebar->setChildrenCollapsible( false ); m_searchWidget = new QSearchField( m_sidebar ); m_searchWidget->setPlaceholderText( tr( "Global Search..." ) ); connect( m_searchWidget, SIGNAL( returnPressed() ), this, SLOT( onFilterEdited() ) ); m_sourcetree = new SourceTreeView(); JobStatusView* jobsView = new JobStatusView( m_sidebar ); m_jobsModel = new JobStatusModel( jobsView ); jobsView->setModel( m_jobsModel ); m_queueView = new QueueView( m_sidebar ); m_queueModel = new PlaylistModel( m_queueView ); m_queueModel->setStyle( PlaylistModel::Short ); m_queueView->queue()->setPlaylistModel( m_queueModel ); m_queueView->queue()->playlistModel()->setReadOnly( false ); AudioEngine::instance()->setQueue( m_queueView->queue()->proxyModel() ); m_sidebar->addWidget( m_searchWidget ); m_sidebar->addWidget( m_sourcetree ); m_sidebar->addWidget( jobsView ); m_sidebar->addWidget( m_queueView ); m_sidebar->setGreedyWidget( 1 ); m_sidebar->hide( 1, false ); m_sidebar->hide( 2, false ); m_sidebar->hide( 3, false ); m_sidebar->hide( 4, false ); sidebarWidget->layout()->addWidget( m_sidebar ); sidebarWidget->setContentsMargins( 0, 0, 0, 0 ); sidebarWidget->layout()->setContentsMargins( 0, 0, 0, 0 ); sidebarWidget->layout()->setMargin( 0 ); #ifndef Q_WS_MAC sidebarWidget->layout()->setSpacing( 0 ); #endif ui->splitter->addWidget( sidebarWidget ); ui->splitter->addWidget( ViewManager::instance()->widget() ); ui->splitter->setStretchFactor( 0, 1 ); ui->splitter->setStretchFactor( 1, 3 ); ui->splitter->setCollapsible( 1, false ); ui->actionShowOfflineSources->setChecked( TomahawkSettings::instance()->showOfflineSources() ); }
RaceWizard::RaceWizard(Race *_race, bool readOnly, QWidget *parent) : QDialog(parent) , page5DataModel(new Page5Model(_race, this)) , race(_race) { pagesWidget = new QStackedWidget; pagesWidget->setContentsMargins(QMargins(0, 0, 0, 0)); QWidget *page1Widget = new QWidget; Ui_RaceWizardPage1 page1; page1.setupUi(page1Widget); pagesWidget->addWidget(page1Widget); createPage2(); createPage3(); QWidget *page4Widget = new QWidget; Ui_RaceWizardPage4 page4; page4.setupUi(page4Widget); pagesWidget->addWidget(page4Widget); createPage5(); createPage6(); QWidget *buttonsPane = new QWidget; buttonsPane->setContentsMargins(QMargins(0, 0, 0, 0)); QPushButton *helpButton = new QPushButton(tr("&Help")); QPushButton *cancelButton = new QPushButton(tr("Cancel")); backButton = new QPushButton(tr("< &Back")); nextButton = new QPushButton(tr("&Next >")); QPushButton *finishButton = new QPushButton(tr("&Finish")); QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(helpButton); layout->addWidget(cancelButton); layout->addWidget(backButton); layout->addWidget(nextButton); layout->addWidget(finishButton); buttonsPane->setLayout(layout); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(pagesWidget); mainLayout->addWidget(buttonsPane); setLayout(mainLayout); page5DataMapper->toFirst(); pageChanged(); connect(helpButton, SIGNAL(clicked(bool)), this, SLOT(helpClicked(bool))); connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancelClicked(bool))); connect(backButton, SIGNAL(clicked(bool)), this, SLOT(backClicked(bool))); connect(nextButton, SIGNAL(clicked(bool)), this, SLOT(nextClicked(bool))); connect(finishButton, SIGNAL(clicked(bool)), this, SLOT(finishClicked(bool))); pagesWidget->setEnabled(!readOnly); }
void LineNumberWidget::UpdateLineNumberArea( const QRect& rect, int dy ) { if( dy ) scroll( 0, dy ); else update( 0, rect.y(), width(), rect.height() ); QWidget* viewport = m_codeEditArea->viewport(); viewport->setContentsMargins( LineNumberAreaWidth(), 0, 0, 0 ); }
void WidgetStack::finish() { QWidget *main = new QWidget; main->setContentsMargins(0, 0, 0, 0); main->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); main->setLayout(_layout); setMaximumWidth(_max_width); setWidget(main); }
QWidget* KexiPropertyPaneViewBase::addWidgetSpacer() { QWidget *sp = new QWidget(this); sp->setFixedHeight(spacing()); sp->setContentsMargins(0, 0, 0, 0); mainLayout()->addWidget(sp); return sp; }
NewsItemWidget::NewsItemWidget(const NewsItemData& Data,QWidget *Parent) : QWidget(Parent), ui(new Ui::NewsItemWidget) { ui->setupUi(this); ui->TitleLabel->setStyleSheet(QString("color : %1;").arg(BUILDER_NEWSLINE_TEXTCOLOR)); ui->DateLabel->setStyleSheet(QString("color : %1;").arg(BUILDER_NEWSLINE_TEXTCOLOR)); ui->TextLabel->setStyleSheet(QString("color : %1;").arg(BUILDER_NEWSLINE_TEXTCOLOR)); ui->TitleLabel->setText(QString("<b>%1</b>").arg(Data.Title)); QDateTime DT = QDateTime::fromString(Data.ISODate,"yyyy-MM-dd'T'hh:mm:ss"); ui->DateLabel->setText(m_Locale.toString(DT)); QString HTMLText = Data.Text; HTMLText.replace(">",">"); HTMLText.replace("<","<"); ui->TextLabel->setText(HTMLText); // to change the color of links, uncomment and use this instead /*ui->TextLabel->setText(QString("<html><head><style type=text/css>" "a:link {color:%1;}" "</style></head><body>%2</body></html>").arg(BUILDER_NEWSLINE_LINKSCOLOR,HTMLText));*/ for (QString Tag : Data.Tags) { QWidget* TagWidget = new QWidget(this); TagWidget->setMinimumWidth(75); QHBoxLayout* TagLayout = new QHBoxLayout(); TagLayout->setSpacing(5); TagLayout->setContentsMargins(0,0,0,0); QString TagLabelText = Tag; TagLabelText.replace(" ","\n"); QLabel* TagLabel = new QLabel(TagLabelText,TagWidget); TagLabel->setWordWrap(true); TagLabel->setStyleSheet(QString("qproperty-alignment: AlignCenter; color : %1; " "background-color : %2 ; border-radius: 4px; padding : 4px; font-size : 9pt;") .arg("white",getCSSColorFromTag(Tag))); TagLayout->addStretch(); TagLayout->addWidget(TagLabel); TagWidget->setLayout(TagLayout); TagWidget->setContentsMargins(0,0,0,0); ui->TagsLayout->addWidget(TagWidget); } ui->TagsLayout->addStretch(); }
AccountListWidget::AccountListWidget( AccountModelFactoryProxy* model, QWidget* parent ) : QWidget( parent ) , m_model( model ) { QVBoxLayout* mainLayout = new QVBoxLayout( this ); TomahawkUtils::unmarginLayout( mainLayout ); m_layout = new QVBoxLayout; TomahawkUtils::unmarginLayout( m_layout ); mainLayout->addLayout( m_layout ); mainLayout->setSpacing( 8 ); connect( m_model, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( updateEntries( QModelIndex, QModelIndex ) ) ); connect( m_model, SIGNAL( rowsInserted ( QModelIndex, int, int ) ), this, SLOT( insertEntries( QModelIndex, int, int ) ) ); connect( m_model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( removeEntries( QModelIndex, int, int ) ) ); connect( m_model, SIGNAL( modelReset() ), this, SLOT( loadAllEntries() ) ); connect( m_model, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( updateToggleOnlineStateButton() ) ); QWidget* separatorLine = new QWidget( this ); separatorLine->setFixedHeight( 1 ); separatorLine->setContentsMargins( 0, 0, 0, 0 ); separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " + TomahawkStyle::BORDER_LINE.name() + "; }" ); //from ProxyStyle mainLayout->insertWidget( 0, separatorLine ); mainLayout->addSpacing( 6 ); QLabel *connectionsLabel = new QLabel( tr( "Connections" ).toUpper(), this ); QFont clFont = connectionsLabel->font(); clFont.setBold( true ); connectionsLabel->setStyleSheet( "color: " + TomahawkStyle::GROUP_HEADER.name() ); clFont.setPointSize( TomahawkUtils::defaultFontSize() + 1 ); connectionsLabel->setFont( clFont ); connectionsLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); m_toggleOnlineButton = new QPushButton( tr( "Connect &All" ), this ); m_toggleOnlineButtonState = false; connect( m_toggleOnlineButton, SIGNAL( clicked() ), this, SLOT( toggleOnlineStateForAll() ) ); QHBoxLayout *headerLayout = new QHBoxLayout( this ); headerLayout->addWidget( connectionsLabel ); headerLayout->addSpacing( 30 ); headerLayout->addWidget( m_toggleOnlineButton ); mainLayout->insertLayout( 0, headerLayout ); updateToggleOnlineStateButton(); }
void MainWindow::showForm(Analysis *analysis) { closeCurrentOptionsWidget(); _currentOptionsWidget = loadForm(analysis); if (_currentOptionsWidget != NULL) { //sizing of options widget and panel to fit buttons and conform to largest size for consistency QObjectList siblings = _currentOptionsWidget->children(); for (QObjectList::Iterator itr = siblings.begin(); itr != siblings.end(); itr++) { QWidget* w = dynamic_cast<QWidget*>(*itr); if (w != NULL && w->objectName() == "topWidget") { w->setContentsMargins(0, 0, _buttonPanel->width(), 0); break; } } int requiredSize = _currentOptionsWidget->sizeHint().width(); int currentOptionSpace = ui->panelMid->minimumWidth() - _scrollbarWidth; if (requiredSize > currentOptionSpace) { ui->panelMid->setMinimumWidth(requiredSize + _scrollbarWidth); _buttonPanel->move(ui->panelMid->width() - _buttonPanel->width() - _scrollbarWidth, 0); } _currentOptionsWidget->setMinimumWidth(ui->panelMid->minimumWidth() - _scrollbarWidth); //######################### Options *options = analysis->options(); DataSet *dataSet = _package->dataSet; _currentOptionsWidget->bindTo(options, dataSet); connect(_currentOptionsWidget, SIGNAL(illegalChanged()), this, SLOT(illegalOptionStateChanged())); illegalOptionStateChanged(); _currentOptionsWidget->show(); ui->optionsContentAreaLayout->addWidget(_currentOptionsWidget,0, 0, Qt::AlignRight | Qt::AlignTop); if (ui->panelMid->isVisible() == false) showOptionsPanel(); _runButton->setVisible(_currentAnalysis->isAutorun() == false); _runButton->setEnabled(_currentAnalysis->status() == Analysis::InitedAndWaiting); _buttonPanel->raise(); _buttonPanel->show(); QString helpPage = QString("analyses/") + tq(analysis->name()).toLower(); requestHelpPage(helpPage); } }
IntelligentSeparatedMultifunctionalButtonWidget::IntelligentSeparatedMultifunctionalButtonWidget(IntelligentSeparatedMultifunctionalButtonWidgetOptionItemModel *defaultOptionItemModel, QList<IntelligentSeparatedMultifunctionalButtonWidgetOptionItemModel *> otherOptionItemModels, QSize collapsedSize, QSize expandedSize, bool isExpandedByDefault, QPixmap expandCollapseButtonPixmap, QPixmap backgroundPixmap, QWidget *parent) : AnimatedTwoFixedSizeWidgetBase(1000, collapsedSize, expandedSize, isExpandedByDefault, true, true, parent) { mainLayout = new QVBoxLayout; this->setLayout(mainLayout); this->setContentsMargins(BUTTON_CONTENT_LEFT_MARGIN, BUTTON_CONTENT_TOP_MARGIN, BUTTON_CONTENT_RIGHT_MARGIN, BUTTON_CONTENT_BOTTOM_MARGIN); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); // mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); // makes it flickering mainLayout->setSizeConstraint(QLayout::SetNoConstraint); // default option item line QWidget *defaultOptionLineWidget = new QWidget; this->defaultOptionItemLineHorizontalLayout = new QHBoxLayout; defaultOptionLineWidget->setLayout(this->defaultOptionItemLineHorizontalLayout); defaultOptionLineWidget->setContentsMargins(0, 0, 0, 0); this->defaultOptionItemLineHorizontalLayout->setContentsMargins(0, 0, 0, 0); this->defaultOptionItemLineHorizontalLayout->setSpacing(0); defaultOptionLineWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // default option item widget QSize defaultItemTextSize = TextSizeHelper::getTextSizeWithFont(defaultOptionItemModel->getTitleText(), defaultOptionItemModel->getPreferedFont()); defaultItemTextSize = QSize(defaultItemTextSize.width() + ITEM_TEXT_TRESHOLD_WIDTH, defaultItemTextSize.height() + ITEM_TEXT_TRESHOLD_HEIGHT); this->defaultOptionItemWidget = this->createWidgetFromOptionItemModel(defaultOptionItemModel, defaultItemTextSize, defaultItemTextSize, true); this->defaultOptionItemLineHorizontalLayout->addWidget(this->defaultOptionItemWidget, 0, Qt::AlignLeft); this->expandCollapseImageWidget = new SimpleImagePresenterWidget(); this->expandCollapseImageWidget->setImageByPixmap(expandCollapseButtonPixmap); connect(this->expandCollapseImageWidget, SIGNAL(clicked()), this, SLOT(expandCollapseWidgetClicked())); this->expandCollapseImageWidget->setFixedSize(EXPAND_COLLAPSE_BUTTON_WIDTH, EXPAND_COLLAPSE_BUTTON_HEIGHT); this->defaultOptionItemLineHorizontalLayout->addWidget(this->expandCollapseImageWidget, 0, Qt::AlignRight); this->mainLayout->addWidget(defaultOptionLineWidget); // other option items // add them to the layout, but hidden by default int otherOptionsCount = otherOptionItemModels.size(); for(int i = 0; i < otherOptionsCount; i++) { IntelligentSeparatedMultifunctionalButtonWidgetOptionItemModel *optionItemModel = otherOptionItemModels[i]; QSize otherOptionItemTextSize = TextSizeHelper::getTextSizeWithFont(optionItemModel->getTitleText(), optionItemModel->getPreferedFont()); otherOptionItemTextSize = QSize(otherOptionItemTextSize.width() + ITEM_TEXT_TRESHOLD_WIDTH, otherOptionItemTextSize.height() + ITEM_TEXT_TRESHOLD_HEIGHT); IntelligentSeparatedMultifunctionalButtonWidgetOptionItemWidget *wrapperWidget = this->createWidgetFromOptionItemModel(optionItemModel, QSize(0, 0), otherOptionItemTextSize, this->getIsExpanded()); this->mainLayout->addWidget(wrapperWidget); this->otherOptionItemWidgets.append(wrapperWidget); } // set the background this->backgroundPixmap = backgroundPixmap; }
// ---------------------------------- //virtual QWidget * MTAssetDetails::CreateCustomTab(int nTab) { const int nCustomTabCount = this->GetCustomTabCount(); // ----------------------------- if ((nTab < 0) || (nTab >= nCustomTabCount)) return NULL; // out of bounds. // ----------------------------- QWidget * pReturnValue = NULL; // ----------------------------- switch (nTab) { case 0: { if (m_pPlainTextEdit) { m_pPlainTextEdit->setParent(NULL); m_pPlainTextEdit->disconnect(); m_pPlainTextEdit->deleteLater(); m_pPlainTextEdit = NULL; } m_pPlainTextEdit = new QPlainTextEdit; m_pPlainTextEdit->setReadOnly(true); m_pPlainTextEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); // ------------------------------- QVBoxLayout * pvBox = new QVBoxLayout; QLabel * pLabelContents = new QLabel(tr("Asset Contract:")); pvBox->setAlignment(Qt::AlignTop); pvBox->addWidget (pLabelContents); pvBox->addWidget (m_pPlainTextEdit); // ------------------------------- pReturnValue = new QWidget; pReturnValue->setContentsMargins(0, 0, 0, 0); pReturnValue->setLayout(pvBox); } break; default: qDebug() << QString("Unexpected: MTAssetDetails::CreateCustomTab was called with bad index: %1").arg(nTab); return NULL; } // ----------------------------- return pReturnValue; }
RideSummaryWindow::RideSummaryWindow(MainWindow *mainWindow, bool ridesummary) : GcChartWindow(mainWindow), mainWindow(mainWindow), ridesummary(ridesummary), useCustom(false), useToToday(false) { setInstanceName("Ride Summary Window"); setRideItem(NULL); // allow user to select date range if in summary mode dateSetting = new DateSettingsEdit(this); if (ridesummary) { setControls(NULL); dateSetting->hide(); // not needed, but holds property values } else { QWidget *c = new QWidget; c->setContentsMargins(0,0,0,0); QFormLayout *cl = new QFormLayout(c); cl->setContentsMargins(0,0,0,0); cl->setSpacing(0); setControls(c); cl->addRow(new QLabel(tr("Date range")), dateSetting); } QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setSpacing(0); vlayout->setContentsMargins(10,10,10,10); rideSummary = new QWebView(this); rideSummary->setContentsMargins(0,0,0,0); rideSummary->page()->view()->setContentsMargins(0,0,0,0); rideSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); rideSummary->setAcceptDrops(false); QFont defaultFont; // mainwindow sets up the defaults.. we need to apply rideSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); rideSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); vlayout->addWidget(rideSummary); if (ridesummary) { connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideItemChanged())); connect(mainWindow, SIGNAL(zonesChanged()), this, SLOT(refresh())); connect(mainWindow, SIGNAL(intervalsChanged()), this, SLOT(refresh())); } else {
UIntControl::UIntControl(const std::string& name, unsigned int* pairedValue, unsigned int min, unsigned int max, std::string label, bool scrubHandle) : Control(name, label), m_minimum(min), m_maximum(max) { m_intSpin = new SpinBoxEx(); m_intSpin->setMinimumSize(100, 22); m_intSpin->setMinimum(min); m_intSpin->setMaximum(max); m_intSpin->setValue(*pairedValue); QWidget* pMainWidget = m_intSpin; if (scrubHandle) { QWidget* mainWidget = new QWidget(); mainWidget->setMinimumSize(100, 26); mainWidget->setContentsMargins(0, 0, 0, 0); QHBoxLayout* layout = new QHBoxLayout(mainWidget); mainWidget->setLayout(layout); layout->setSpacing(0); layout->setContentsMargins(0, 0, 0, 0); layout->setMargin(0); layout->addWidget(m_intSpin); layout->addSpacing(5); ScrubButton* pScrubButton = new ScrubButton(); layout->addWidget(pScrubButton); pMainWidget = mainWidget; m_pConnectionProxy->registerDeltaChange(pScrubButton, 0); } m_widget = pMainWidget; m_pairedValue = pairedValue; m_pConnectionProxy->registerValueChangedDouble(m_intSpin); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QPushButton *btn1 = new QPushButton("添加"); QPushButton *btn2 = new QPushButton("删除"); QHBoxLayout *btnLayout = new QHBoxLayout; btnLayout->addWidget(btn1); btnLayout->addWidget(btn2); /*添加一个项列表并把它放置于一个DockWidget中*/ m_ListView = new ListView; QVBoxLayout *DWLayout = new QVBoxLayout; DWLayout->setContentsMargins(0,0,0,2); DWLayout->setSpacing(2); DWLayout->addWidget(m_ListView); DWLayout->addLayout(btnLayout); QWidget *DWWidget = new QWidget; DWWidget->setMinimumWidth(250); DWWidget->setLayout(DWLayout); m_indexDWidget = new QDockWidget; m_indexDWidget->setWidget(DWWidget); this->addDockWidget(Qt::LeftDockWidgetArea,m_indexDWidget); /*主布局管理器.*/ QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->setContentsMargins(0,0,0,0); /*主widget*/ QWidget *centerWidget = new QWidget; centerWidget->setContentsMargins(0,0,0,0); centerWidget->setLayout(mainLayout); this->setCentralWidget(centerWidget); this->resize(1280,720); }
QVariantListPropertyWidgetItem::QVariantListPropertyWidgetItem(QWidget* parent, Qt::WindowFlags f) : PropertyWidgetItem(parent, f) { additionMenu = new QMenu(this); QAction* addInt = new QAction(i18n("Integer"), additionMenu); addInt->setData(QVariant(0)); connect(addInt, SIGNAL(triggered(bool)), SLOT(addItem())); additionMenu->addAction(addInt); QAction* addDouble = new QAction(i18n("Floating point number"), additionMenu); addDouble->setData(QVariant(1)); connect(addDouble, SIGNAL(triggered(bool)), SLOT(addItem())); additionMenu->addAction(addDouble); QAction* addString = new QAction(i18n("String"), additionMenu); addString->setData(QVariant(2)); connect(addString, SIGNAL(triggered(bool)), SLOT(addItem())); additionMenu->addAction(addString); QWidget* centralWidget = new QWidget( this ); centralWidget->setContentsMargins( 0, 0, 0, 0 ); QGridLayout* layout = new QGridLayout( centralWidget ); layout->setSpacing( 0 ); addButton = new QToolButton( centralWidget ); addButton->setIcon( QIcon::fromTheme( "list-add" ) ); connect( addButton, SIGNAL(clicked(bool)), SLOT(showAdditionMenu()) ); layout->addWidget( addButton, 0, 0 ); countLabel = new QLabel( centralWidget ); countLabel->setText( i18n( "Item count: %1" ).arg(0) ); layout->addWidget( countLabel, 0, 1 ); listItems = new QWidget( centralWidget ); listItems->setLayout( new QVBoxLayout() ); listItems->layout()->setMargin( 0 ); listItems->layout()->setSpacing( 0 ); listItems->setContentsMargins( 0, 0, 0, 0 ); layout->addWidget( listItems, 1, 0, 1, 2 ); setEditWidget( centralWidget ); }
void AntistringConfigurationUiHandler::mainConfigurationWindowCreated(MainConfigurationWindow *mainConfigurationWindow) { ConfigGroupBox *groupBox = mainConfigurationWindow->widget()->configGroupBox("Chat", "Antistring", "Conditions"); QWidget *widget = new QWidget(groupBox->widget()); widget->setContentsMargins(0, 0, 0, 0); QGridLayout *layout = new QGridLayout(widget); ConditionListWidget = new QListWidget(widget); layout->addWidget(ConditionListWidget, 0, 0, 1, 4); ConditionWidget = new QLineEdit(widget); layout->addWidget(new QLabel(tr("Condition"), widget), 1, 0); layout->addWidget(ConditionWidget, 1, 1, 1, 3); FactorWidget = new QSpinBox(widget); FactorWidget->setMinimum(0); FactorWidget->setMaximum(5); FactorWidget->setSpecialValueText(tr("Don't use")); layout->addWidget(new QLabel(tr("Factor"), widget), 2, 0); layout->addWidget(FactorWidget, 2, 1, 1, 3); QPushButton *addConditionButton = new QPushButton(tr("Add"), widget); QPushButton *changeConditionButton = new QPushButton(tr("Change"), widget); QPushButton *deleteConditionButton = new QPushButton(tr("Delete"), widget); layout->addWidget(addConditionButton, 3, 1); layout->addWidget(changeConditionButton, 3, 2); layout->addWidget(deleteConditionButton, 3, 3); groupBox->addWidget(widget); connect(ConditionListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(wordSelected(QListWidgetItem *))); connect(addConditionButton, SIGNAL(clicked()), this, SLOT(addCondition())); connect(changeConditionButton, SIGNAL(clicked()), this, SLOT(changeCondition())); connect(deleteConditionButton, SIGNAL(clicked()), this, SLOT(deleteCondition())); updateConditionList(); connect(mainConfigurationWindow, SIGNAL(configurationWindowApplied()), this, SLOT(applyConfiguration())); }
void KInfoCenter::createMainFrame() { QWidget *mainDisplay = new QWidget(); mainDisplay->setContentsMargins(0,0,0,0); QHBoxLayout *mainLayout = new QHBoxLayout(mainDisplay); m_splitter = new QSplitter(m_cWidget); m_splitter->setContentsMargins(0, 0, 0, 0); mainLayout->addWidget(m_splitter); createMenuFrame(); m_contain = new KcmContainer(m_splitter); m_splitter->addWidget(m_contain); m_splitter->setStretchFactor(0, 0); m_splitter->setStretchFactor(1, 1); m_cWidget->layout()->addWidget(mainDisplay); }
// ---------------------------------- //virtual QWidget * MTAccountDetails::CreateCustomTab(int nTab) { const int nCustomTabCount = this->GetCustomTabCount(); // ----------------------------- if ((nTab < 0) || (nTab >= nCustomTabCount)) return NULL; // out of bounds. // ----------------------------- QWidget * pReturnValue = NULL; // ----------------------------- switch (nTab) { case 0: // "Cash Purse" tab if (NULL != m_pOwner) { if (m_pCashPurse) { m_pCashPurse->setParent(NULL); m_pCashPurse->disconnect(); m_pCashPurse->deleteLater(); m_pCashPurse = NULL; } m_pCashPurse = new MTCashPurse(NULL, *m_pOwner); pReturnValue = m_pCashPurse; pReturnValue->setContentsMargins(0, 0, 0, 0); connect(m_pCashPurse, SIGNAL(balancesChanged(QString)), m_pOwner, SLOT(onBalancesChangedFromBelow(QString))); } break; default: qDebug() << QString("Unexpected: MTAccountDetails::CreateCustomTab was called with bad index: %1").arg(nTab); return NULL; } // ----------------------------- return pReturnValue; }
void MainWindow::addCoreParameterView(IView * coreParameterView) { QWidget* coreParameter = dynamic_cast<QWidget*>(coreParameterView); if (coreParameter) { //add experiment widget to toolbar QWidget* experimentWidget = coreParameter->findChild<QWidget*>("experimentWidget"); if (experimentWidget) { ui->experimentItem->layout()->addWidget(experimentWidget); } ui->widget_alg->updateGeometry(); coreParameter->updateGeometry(); coreParameter->setContentsMargins(QMargins(0, 0, 0, 0)); coreParameter->setParent(ui->widget_alg); QHBoxLayout* hLayout = new QHBoxLayout; hLayout->addWidget(coreParameter, 100, 0); hLayout->setContentsMargins(QMargins(0, 0, 0, 0)); //left, top, right, bottom hLayout->setMargin(0); ui->widget_alg->setLayout(hLayout); coreParameter->setVisible(1); _currentCoreParameterView = coreParameterView; //resize rightpanel QList<int> splitterSizes; splitterSizes << 20000 << 10000; //2:1 TODO make this fixed (right panel fixed start size) ui->mainSplitter->setSizes(splitterSizes); } }
TimelineWidget::TimelineWidget(QWidget* parent) : QWidget(parent), m_timelineView(NULL), m_timeRate(1.0), m_paused(true) { m_timelineView = new TimelineView(this); connect(m_timelineView, SIGNAL(currentTimeChanged(double)), this, SIGNAL(currentTimeChanged(double))); QWidget* controls = new QWidget(this); controls->setContentsMargins(0, 0, 0, 0); QHBoxLayout* controlsLayout = new QHBoxLayout(controls); QLabel* zoomLabel = new QLabel(controls); zoomLabel->setText("Zoom: " "<a href=\"0.04167\">1h</a> " "<a href=\"0.08333\">6h</a> " "<a href=\"0.5\">12h</a> " "<a href=\"1\">1d</a> " "<a href=\"5\">5d</a> " "<a href=\"10\">10d</a> " "<a href=\"30\">1m</a> " "<a href=\"180\">6m</a> " "<a href=\"365\">1y</a> " "<a href=\"all\">all</a>"); QToolBar* toolbar = new QToolBar(controls); toolbar->setIconSize(QSize(24, 24)); toolbar->setMaximumHeight(24); toolbar->setMovable(false); toolbar->setFloatable(false); toolbar->setContentsMargins(0, 0, 0, 0); QAction* reverseTimeAction = new QAction(QIcon(":/icons/timeline-reverse.png"), tr("Reverse time"), toolbar); QAction* slowTimeAction = new QAction(QIcon(":/icons/timeline-slower.png"), tr("10x slower"), toolbar); QAction* halfTimeAction = new QAction(QIcon(":/icons/timeline-half.png"), tr("2x slower"), toolbar); QAction* pauseAction = new QAction(QIcon(":/icons/timeline-pause.png"), tr("Pause time"), toolbar); QAction* realTimeAction = new QAction(QIcon(":/icons/timeline-realtime.png"), tr("Real time"), toolbar); QAction* doubleTimeAction = new QAction(QIcon(":/icons/timeline-double.png"), tr("2x faster"), toolbar); QAction* fastTimeAction = new QAction(QIcon(":/icons/timeline-faster.png"), tr("10x faster"), toolbar); connect(reverseTimeAction, SIGNAL(triggered()), this, SLOT(reverseTime())); toolbar->addAction(reverseTimeAction); connect(slowTimeAction, SIGNAL(triggered()), this, SLOT(slowerTime())); toolbar->addAction(slowTimeAction); connect(halfTimeAction, SIGNAL(triggered()), this, SLOT(halfTime())); toolbar->addAction(halfTimeAction); connect(pauseAction, SIGNAL(triggered()), this, SLOT(togglePaused())); toolbar->addAction(pauseAction); connect(realTimeAction, SIGNAL(triggered()), this, SLOT(realTime())); toolbar->addAction(realTimeAction); connect(doubleTimeAction, SIGNAL(triggered()), this, SLOT(doubleTime())); toolbar->addAction(doubleTimeAction); connect(fastTimeAction, SIGNAL(triggered()), this, SLOT(fasterTime())); toolbar->addAction(fastTimeAction); controlsLayout->addWidget(toolbar); controlsLayout->addStretch(1); controlsLayout->addWidget(zoomLabel); controls->setLayout(controlsLayout); connect(zoomLabel, SIGNAL(linkActivated(const QString&)), this, SLOT(setZoom(const QString&))); QVBoxLayout* layout = new QVBoxLayout(this); layout->addWidget(m_timelineView); layout->addWidget(controls); //layout->addLayout(controlsLayout); layout->setContentsMargins(0, 0, 0, 0); this->setLayout(layout); this->show(); m_timelineView->setTimeRange(0.0, 5.0); }
LTMWindow::LTMWindow(Context *context) : GcChartWindow(context), context(context), dirty(true), stackDirty(true), compareDirty(true) { useToToday = useCustom = false; plotted = DateRange(QDate(01,01,01), QDate(01,01,01)); // the plot QVBoxLayout *mainLayout = new QVBoxLayout; ltmPlot = new LTMPlot(this, context, true); // the stack of plots QPalette palette; palette.setBrush(QPalette::Background, QBrush(GColor(CPLOTBACKGROUND))); plotsWidget = new QWidget(this); plotsWidget->setPalette(palette); plotsLayout = new QVBoxLayout(plotsWidget); plotsLayout->setSpacing(0); plotsLayout->setContentsMargins(0,0,0,0); plotArea = new QScrollArea(this); #ifdef Q_OS_WIN QStyle *cde = QStyleFactory::create(OS_STYLE); plotArea->setStyle(cde); #endif plotArea->setAutoFillBackground(false); plotArea->setWidgetResizable(true); plotArea->setWidget(plotsWidget); plotArea->setFrameStyle(QFrame::NoFrame); plotArea->setContentsMargins(0,0,0,0); plotArea->setPalette(palette); // the data table dataSummary = new QWebView(this); dataSummary->setContentsMargins(0,0,0,0); dataSummary->page()->view()->setContentsMargins(0,0,0,0); dataSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); dataSummary->setAcceptDrops(false); QFont defaultFont; // mainwindow sets up the defaults.. we need to apply dataSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1); dataSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family()); // compare plot page compareplotsWidget = new QWidget(this); compareplotsWidget->setPalette(palette); compareplotsLayout = new QVBoxLayout(compareplotsWidget); compareplotsLayout->setSpacing(0); compareplotsLayout->setContentsMargins(0,0,0,0); compareplotArea = new QScrollArea(this); #ifdef Q_OS_WIN cde = QStyleFactory::create(OS_STYLE); compareplotArea->setStyle(cde); #endif compareplotArea->setAutoFillBackground(false); compareplotArea->setWidgetResizable(true); compareplotArea->setWidget(compareplotsWidget); compareplotArea->setFrameStyle(QFrame::NoFrame); compareplotArea->setContentsMargins(0,0,0,0); compareplotArea->setPalette(palette); // the stack stackWidget = new QStackedWidget(this); stackWidget->addWidget(ltmPlot); stackWidget->addWidget(dataSummary); stackWidget->addWidget(plotArea); stackWidget->addWidget(compareplotArea); stackWidget->setCurrentIndex(0); mainLayout->addWidget(stackWidget); setChartLayout(mainLayout); // reveal controls QHBoxLayout *revealLayout = new QHBoxLayout; revealLayout->setContentsMargins(0,0,0,0); revealLayout->addStretch(); revealLayout->addWidget(new QLabel(tr("Group by"),this)); rGroupBy = new QxtStringSpinBox(this); QStringList strings; strings << tr("Days") << tr("Weeks") << tr("Months") << tr("Years") << tr("Time Of Day") << tr("All"); rGroupBy->setStrings(strings); rGroupBy->setValue(0); revealLayout->addWidget(rGroupBy); rData = new QCheckBox(tr("Data Table"), this); rStack = new QCheckBox(tr("Stacked"), this); QVBoxLayout *checks = new QVBoxLayout; checks->setSpacing(2); checks->setContentsMargins(0,0,0,0); checks->addWidget(rData); checks->addWidget(rStack); revealLayout->addLayout(checks); revealLayout->addStretch(); setRevealLayout(revealLayout); // the controls QWidget *c = new QWidget; c->setContentsMargins(0,0,0,0); QVBoxLayout *cl = new QVBoxLayout(c); cl->setContentsMargins(0,0,0,0); cl->setSpacing(0); setControls(c); // the popup popup = new GcPane(); ltmPopup = new LTMPopup(context); QVBoxLayout *popupLayout = new QVBoxLayout(); popupLayout->addWidget(ltmPopup); popup->setLayout(popupLayout); ltmTool = new LTMTool(context, &settings); // initialise settings.ltmTool = ltmTool; settings.data = NULL; settings.groupBy = LTM_DAY; settings.legend = ltmTool->showLegend->isChecked(); settings.events = ltmTool->showEvents->isChecked(); settings.shadeZones = ltmTool->shadeZones->isChecked(); settings.showData = ltmTool->showData->isChecked(); settings.stack = ltmTool->showStack->isChecked(); settings.stackWidth = ltmTool->stackSlider->value(); rData->setChecked(ltmTool->showData->isChecked()); rStack->setChecked(ltmTool->showStack->isChecked()); cl->addWidget(ltmTool); connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange))); connect(ltmTool, SIGNAL(filterChanged()), this, SLOT(filterChanged())); connect(context, SIGNAL(homeFilterChanged()), this, SLOT(filterChanged())); connect(ltmTool->groupBy, SIGNAL(currentIndexChanged(int)), this, SLOT(groupBySelected(int))); connect(rGroupBy, SIGNAL(valueChanged(int)), this, SLOT(rGroupBySelected(int))); connect(ltmTool->applyButton, SIGNAL(clicked(bool)), this, SLOT(applyClicked(void))); connect(ltmTool->shadeZones, SIGNAL(stateChanged(int)), this, SLOT(shadeZonesClicked(int))); connect(ltmTool->showData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int))); connect(rData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int))); connect(ltmTool->showStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int))); connect(rStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int))); connect(ltmTool->stackSlider, SIGNAL(valueChanged(int)), this, SLOT(zoomSliderChanged())); connect(ltmTool->showLegend, SIGNAL(stateChanged(int)), this, SLOT(showLegendClicked(int))); connect(ltmTool->showEvents, SIGNAL(stateChanged(int)), this, SLOT(showEventsClicked(int))); connect(ltmTool, SIGNAL(useCustomRange(DateRange)), this, SLOT(useCustomRange(DateRange))); connect(ltmTool, SIGNAL(useThruToday()), this, SLOT(useThruToday())); connect(ltmTool, SIGNAL(useStandardRange()), this, SLOT(useStandardRange())); connect(ltmTool, SIGNAL(curvesChanged()), this, SLOT(refresh())); connect(context, SIGNAL(filterChanged()), this, SLOT(refresh())); // comparing things connect(context, SIGNAL(compareDateRangesStateChanged(bool)), this, SLOT(compareChanged())); connect(context, SIGNAL(compareDateRangesChanged()), this, SLOT(compareChanged())); connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(refresh(void))); connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(refresh(void))); connect(context, SIGNAL(configChanged()), this, SLOT(configChanged())); connect(context, SIGNAL(presetSelected(int)), this, SLOT(presetSelected(int))); configChanged(); }
ClipsWidget::ClipsWidget(ClipboardManager& clipboardManager, QWidget* parent) : View(parent), clipboardManager(clipboardManager), mainLayout(new QVBoxLayout), searchEdit(new QLineEdit(this)), stacked(new QStackedLayout), mruTable(new ClipsTable(this)), savedTable(new ClipsTable(this)), saveAction(new QAction(tr("&Save as..."), this)), removeAction(new QAction(tr("&Remove"), this)), resultsTable(new ClipsTable(this)) { // Layout this->setLayout(this->mainLayout); QFormLayout* searchForm = new QFormLayout; searchForm->addRow(tr("&Search:"), this->searchEdit); this->mainLayout->addLayout(searchForm); QSplitter* tableSplitter = new QSplitter(Qt::Vertical, this); tableSplitter->addWidget(this->mruTable); QWidget* savedContainer = new QWidget(this); QVBoxLayout* savedLayout = new QVBoxLayout; savedLayout->setContentsMargins(0, 0, 0, 0); savedContainer->setLayout(savedLayout); QLabel* savedLabel = new QLabel(tr("Sa&ved clips:"), this); savedLabel->setBuddy(this->savedTable); savedLayout->addWidget(savedLabel); savedLayout->addWidget(this->savedTable); tableSplitter->addWidget(savedContainer); this->stacked->addWidget(tableSplitter); QWidget* resultsContainer = new QWidget(this); resultsContainer->setContentsMargins(0, 0, 0, 0); QVBoxLayout* resultsLayout = new QVBoxLayout; resultsLayout->setContentsMargins(0, 0, 0, 0); resultsLayout->addWidget(new QLabel(tr("Results:"), this)); resultsLayout->addWidget(this->resultsTable); resultsContainer->setLayout(resultsLayout); this->stacked->addWidget(resultsContainer); this->mainLayout->addLayout(this->stacked); // Context menu actions this->mruTable->addContextMenuAction(this->saveAction); this->mruTable->addContextMenuAction(this->removeAction); this->savedTable->addContextMenuAction(this->removeAction); connect(this->mruTable, &ClipsTable::contextActionTriggered, this, &ClipsWidget::handleContextMenuAction); connect(this->savedTable, &ClipsTable::contextActionTriggered, this, &ClipsWidget::handleContextMenuAction); // Data binding connect(&this->clipboardManager, &ClipboardManager::mruPushed, this->mruTable, &ClipsTable::prependClip); connect(&this->clipboardManager, &ClipboardManager::mruRemoved, this->mruTable, &ClipsTable::removeClipFromTable); connect(&this->clipboardManager, &ClipboardManager::clipInserted, [this](ClipsGroup*,int,QSharedPointer<Clip> clip) { this->savedTable->prependClip(clip); }); connect(&this->clipboardManager, &ClipboardManager::clipRemoved, [this](ClipsGroup*,QSharedPointer<Clip> clip) { this->savedTable->removeClipFromTable(clip); }); connect(this->searchEdit, &QLineEdit::textChanged, this, &ClipsWidget::updateResults); }
LoopLibraryDialog::LoopLibraryDialog(QWidget * parent) : QDialog(parent) { setObjectName("GrayWidget"); setFixedSize(280,584); setWindowTitle("Add HVAC System"); setWindowFlags(Qt::WindowFlags(Qt::Dialog | Qt::WindowTitleHint)); QVBoxLayout * mainVLayout = new QVBoxLayout(); mainVLayout->setContentsMargins(0,0,0,0); mainVLayout->setSpacing(0); setLayout(mainVLayout); QLabel * loopsLabel = new QLabel("HVAC Systems"); loopsLabel->setStyleSheet("QLabel { margin-left: 5px; }"); mainVLayout->addSpacing(5); mainVLayout->addWidget(loopsLabel); mainVLayout->addSpacing(5); QFrame * divider = new QFrame(); divider->setFrameShape(QFrame::HLine); divider->setFrameShadow(QFrame::Sunken); mainVLayout->addWidget(divider); QWidget * scrollAreaWidget = new QWidget(); scrollAreaWidget->setContentsMargins(0,0,0,0); scrollAreaWidget->setObjectName("GrayWidget"); QVBoxLayout * scrollAreaLayout = new QVBoxLayout(); scrollAreaLayout->setContentsMargins(0,0,0,0); scrollAreaLayout->setSpacing(0); scrollAreaLayout->setAlignment(Qt::AlignTop); scrollAreaWidget->setLayout(scrollAreaLayout); m_scrollArea = new QScrollArea(); m_scrollArea->setFrameStyle(QFrame::NoFrame); m_scrollArea->setWidget(scrollAreaWidget); m_scrollArea->setWidgetResizable(true); m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); mainVLayout->addWidget(m_scrollArea,100); mainVLayout->addStretch(); //newItem( ADDTOMODEL_SYSTEM_TYPE_1, // QString("Packaged Terminal \nAir Conditioner"), // QPixmap(":/images/system_type_1.png") ); //newItem( ADDTOMODEL_SYSTEM_TYPE_2, // QString("Packaged Terminal Heat Pump"), // QPixmap(":/images/system_type_2.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_3, QString("Packaged Rooftop Unit"), QPixmap(":/images/system_type_3.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_4, QString("Packaged Rooftop Heat Pump"), QPixmap(":/images/system_type_4.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_5, QString("Packaged DX Rooftop VAV \nwith Reheat"), QPixmap(":/images/system_type_5.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_6, QString("Packaged Rooftop \nVAV with Parallel Fan \nPower Boxes and reheat"), QPixmap(":/images/system_type_6.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_7, QString("Packaged Rooftop \nVAV with Reheat"), QPixmap(":/images/system_type_7.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_8, QString("VAV with Parallel Fan-Powered \nBoxes and Reheat"), QPixmap(":/images/system_type_8.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_9, QString("Warm Air Furnace \nGas Fired"), QPixmap(":/images/system_type_9.png") ); newItem( ADDTOMODEL_SYSTEM_TYPE_10, QString("Warm Air Furnace \nElectric"), QPixmap(":/images/system_type_10.png") ); newItem( ADDTOMODEL_AIRLOOPHVAC, QString("Empty Air Loop"), QPixmap(":/images/air_loop_icon.png") ); newItem( ADDTOMODEL_PLANTLOOP, QString("Empty Plant Loop"), QPixmap(":/images/plant_loop_icon.png") ); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), logNewMessages(0), logHasErrors(false), showNewLogNumber(true) { ui->setupUi(this); setWindowIcon(QIcon(c_icon_app)); setWindowTitle(c_qtau_name); setAcceptDrops(true); setContextMenuPolicy(Qt::NoContextMenu); //----------------------------------------- QLabel *meterLabel = new QLabel(QString("%1/%2") .arg(ns.notesInBar).arg(ns.noteLength), this); QLabel *tempoLabel = new QLabel(QString("%1 %2").arg(ns.tempo).arg(tr("bpm")), this); QHBoxLayout *bpmHBL = new QHBoxLayout(); bpmHBL->setContentsMargins(0,0,0,0); bpmHBL->addSpacing(5); bpmHBL->addWidget(meterLabel); bpmHBL->addWidget(tempoLabel); bpmHBL->addSpacing(5); QFrame *tempoPanel = new QFrame(this); tempoPanel->setMinimumSize(c_piano_min_width, c_meter_min_height); tempoPanel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); tempoPanel->setContentsMargins(1,0,1,1); tempoPanel->setFrameStyle(QFrame::Panel | QFrame::Raised); tempoPanel->setLayout(bpmHBL); meter = new qtauMeterBar(this); meter->setMinimumHeight(c_meter_min_height); meter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); meter->setContentsMargins(0,0,0,0); piano = new qtauPiano(ui->centralWidget); piano->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); piano->setMinimumSize(c_piano_min_width, c_piano_min_height); piano->setContentsMargins(0,0,0,0); zoom = new QSlider(Qt::Horizontal, ui->centralWidget); zoom->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); zoom->setRange(0, c_zoom_num - 1); zoom->setSingleStep(1); zoom->setPageStep(1); zoom->setValue(cdef_zoom_index); zoom->setMinimumWidth(c_piano_min_width); zoom->setGeometry(0,0,c_piano_min_width,10); zoom->setContentsMargins(0,0,0,0); noteEditor = new qtauNoteEditor(ui->centralWidget); noteEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); noteEditor->setContentsMargins(0,0,0,0); hscr = new QScrollBar(Qt::Horizontal, ui->centralWidget); vscr = new QScrollBar(Qt::Vertical, ui->centralWidget); hscr->setContentsMargins(0,0,0,0); vscr->setContentsMargins(0,0,0,0); hscr->setRange(0, ns.note.width() * ns.notesInBar * cdef_bars); vscr->setRange(0, ns.note.height() * 12 * ns.numOctaves); hscr->setSingleStep(ns.note.width()); vscr->setSingleStep(ns.note.height()); hscr->setContextMenuPolicy(Qt::NoContextMenu); vscr->setContextMenuPolicy(Qt::NoContextMenu); //---- vocal and music waveform panels, hidden until synthesized (vocal wave) and/or loaded (music wave) QScrollBar *dummySB = new QScrollBar(this); dummySB->setOrientation(Qt::Vertical); dummySB->setRange(0,0); dummySB->setEnabled(false); QFrame *vocalControls = new QFrame(this); vocalControls->setContentsMargins(0,0,0,0); vocalControls->setMinimumSize(c_piano_min_width, c_waveform_min_height); vocalControls->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); vocalControls->setFrameStyle(QFrame::Panel | QFrame::Raised); vocalWave = new qtauWaveform(this); vocalWave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); vocalWave->setMinimumHeight(c_waveform_min_height); vocalWave->setContentsMargins(0,0,0,0); QHBoxLayout *vocalWaveL = new QHBoxLayout(); vocalWaveL->setContentsMargins(0,0,0,0); vocalWaveL->setSpacing(0); vocalWaveL->addWidget(vocalControls); vocalWaveL->addWidget(vocalWave); vocalWaveL->addWidget(dummySB); vocalWavePanel = new QWidget(this); vocalWavePanel->setContentsMargins(0,0,0,0); vocalWavePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); vocalWavePanel->setLayout(vocalWaveL); vocalWavePanel->setVisible(false); //--------- QScrollBar *dummySB2 = new QScrollBar(this); dummySB2->setOrientation(Qt::Vertical); dummySB2->setRange(0,0); dummySB2->setEnabled(false); QFrame *musicControls = new QFrame(this); musicControls->setContentsMargins(0,0,0,0); musicControls->setMinimumSize(c_piano_min_width, c_waveform_min_height); musicControls->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); musicControls->setFrameStyle(QFrame::Panel | QFrame::Raised); musicWave = new qtauWaveform(this); musicWave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); musicWave->setMinimumHeight(c_waveform_min_height); musicWave->setContentsMargins(0,0,0,0); QHBoxLayout *musicWaveL = new QHBoxLayout(); musicWaveL->setContentsMargins(0,0,0,0); musicWaveL->setSpacing(0); musicWaveL->addWidget(musicControls); musicWaveL->addWidget(musicWave); musicWaveL->addWidget(dummySB2); musicWavePanel = new QWidget(this); musicWavePanel->setContentsMargins(0,0,0,0); musicWavePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); musicWavePanel->setLayout(musicWaveL); musicWavePanel->setVisible(false); //---- notes' dynamics setup area -------------- QGridLayout *dynBtnL = new QGridLayout(); QString btnNames[c_dynbuttons_num] = {"VEL", "DYN", "BRE", "BRI", "CLE", "OPE", "GEN", "POR", "PIT", "PBS"}; for (int i = 0; i < c_dynbuttons_num; ++i) { qtauDynLabel *l = new qtauDynLabel(btnNames[i], this); l->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); dynBtnL->addWidget(l, i / 2, i % 2, 1, 1); l->setStyleSheet(c_dynlbl_css_off); l->setFrameStyle(QFrame::Box); l->setLineWidth(1); connect(l, SIGNAL(leftClicked()), SLOT(dynBtnLClicked())); connect(l, SIGNAL(rightClicked()), SLOT(dynBtnRClicked())); } dynBtnL->setRowStretch(c_dynbuttons_num / 2, 100); QFrame *dynBtnPanel = new QFrame(this); dynBtnPanel->setContentsMargins(0,0,0,0); dynBtnPanel->setMinimumSize(c_piano_min_width, c_drawzone_min_height); dynBtnPanel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); dynBtnPanel->setFrameStyle(QFrame::Panel | QFrame::Raised); dynBtnPanel->setLayout(dynBtnL); drawZone = new qtauDynDrawer(ui->centralWidget); drawZone->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); drawZone->setMinimumHeight(c_drawzone_min_height); drawZone->setContentsMargins(0,0,0,0); QScrollBar *dummySB3 = new QScrollBar(this); dummySB3->setOrientation(Qt::Vertical); dummySB3->setRange(0,0); dummySB3->setEnabled(false); QHBoxLayout *singParamsL = new QHBoxLayout(); singParamsL->setContentsMargins(0,0,0,0); singParamsL->setSpacing(0); singParamsL->addWidget(dynBtnPanel); singParamsL->addWidget(drawZone); singParamsL->addWidget(dummySB3); drawZonePanel = new QWidget(this); drawZonePanel->setContentsMargins(0,0,0,0); drawZonePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); drawZonePanel->setLayout(singParamsL); //---- Combining editor panels into hi-level layout ------ QGridLayout *gl = new QGridLayout(); gl->setContentsMargins(0,0,0,0); gl->setSpacing(0); gl->addWidget(tempoPanel, 0, 0, 1, 1); gl->addWidget(meter, 0, 1, 1, 1); gl->addWidget(piano, 1, 0, 1, 1); gl->addWidget(zoom, 2, 0, 1, 1); gl->addWidget(noteEditor, 1, 1, 1, 1); gl->addWidget(hscr, 2, 1, 1, 1); gl->addWidget(vscr, 1, 2, 1, 1); QWidget *editorUpperPanel = new QWidget(this); editorUpperPanel->setContentsMargins(0,0,0,0); editorUpperPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); editorUpperPanel->setMaximumSize(9000,9000); editorUpperPanel->setLayout(gl); editorSplitter = new QSplitter(Qt::Vertical, this); editorSplitter->setContentsMargins(0,0,0,0); editorSplitter->addWidget(editorUpperPanel); editorSplitter->addWidget(vocalWavePanel); editorSplitter->addWidget(musicWavePanel); editorSplitter->addWidget(drawZonePanel); editorSplitter->setStretchFactor(0, 1); editorSplitter->setStretchFactor(1, 0); editorSplitter->setStretchFactor(2, 0); editorSplitter->setStretchFactor(3, 0); QVBoxLayout *edVBL = new QVBoxLayout(); edVBL->setContentsMargins(0,0,0,0); edVBL->addWidget(editorSplitter); QWidget *editorPanel = new QWidget(this); editorPanel->setContentsMargins(0,0,0,0); editorPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); editorPanel->setMaximumSize(9000,9000); editorPanel->setLayout(edVBL); //---- Voicebank setup tab --------------------- QWidget *voicesPanel = new QWidget(this); voicesPanel->setContentsMargins(0,0,0,0); voicesPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); voicesPanel->setMaximumSize(9000,9000); //---- Plugins setup tab ----------------------- QWidget *pluginsPanel = new QWidget(this); pluginsPanel->setContentsMargins(0,0,0,0); pluginsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pluginsPanel->setMaximumSize(9000,9000); //---- Settings tab ---------------------------- QWidget *settingsPanel = new QWidget(this); settingsPanel->setContentsMargins(0,0,0,0); settingsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); settingsPanel->setMaximumSize(9000,9000); //---- Documentation tab ----------------------- QWidget *docsPanel = new QWidget(this); docsPanel->setContentsMargins(0,0,0,0); docsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); docsPanel->setMaximumSize(9000,9000); QTextEdit *docpad = new QTextEdit(this); docpad->setReadOnly(true); docpad->setUndoRedoEnabled(false); docpad->setContextMenuPolicy(Qt::NoContextMenu); QFile embeddedDocTxt(c_doc_txt); if (embeddedDocTxt.open(QFile::ReadOnly)) { QTextStream ts(&embeddedDocTxt); ts.setAutoDetectUnicode(true); ts.setCodec("UTF-8"); docpad->setText(ts.readAll()); embeddedDocTxt.close(); } QGridLayout *docL = new QGridLayout(); docL->setContentsMargins(0,0,0,0); docL->addWidget(docpad, 0, 0, 1, 1); docsPanel->setLayout(docL); //---- Log tab --------------------------------- QWidget *logPanel = new QWidget(this); logPanel->setContentsMargins(0,0,0,0); logPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); logPanel->setMaximumSize(9000,9000); logpad = new QTextEdit(this); logpad->setReadOnly(true); logpad->setUndoRedoEnabled(false); logpad->setContextMenuPolicy(Qt::NoContextMenu); logpad->setStyleSheet("p, pre { white-space: 1.2; }"); QGridLayout *logL = new QGridLayout(); logL->setContentsMargins(0,0,0,0); logL->addWidget(logpad, 0, 0, 1, 1); logPanel->setLayout(logL); //---- Combining tabs togeter ------------------ tabs = new QTabWidget(this); tabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tabs->setContentsMargins(0,0,0,0); tabs->setMaximumSize(9000, 9000); tabs->setTabPosition(QTabWidget::South); tabs->setMovable(false); // just to be sure tabs->addTab(editorPanel, QIcon(c_icon_editor), tr("Editor")); tabs->addTab(voicesPanel, QIcon(c_icon_voices), tr("Voices")); tabs->addTab(pluginsPanel, QIcon(c_icon_plugins), tr("Plugins")); tabs->addTab(settingsPanel, QIcon(c_icon_settings), tr("Settings")); tabs->addTab(docsPanel, QIcon(c_icon_doc), tr("Documentation")); tabs->addTab(logPanel, QIcon(c_icon_log), tr("Log")); tabs->widget(0)->setContentsMargins(0,0,0,0); tabs->widget(1)->setContentsMargins(0,0,0,0); tabs->widget(2)->setContentsMargins(0,0,0,0); tabs->widget(3)->setContentsMargins(0,0,0,0); tabs->widget(4)->setContentsMargins(0,0,0,0); tabs->widget(5)->setContentsMargins(0,0,0,0); logTabTextColor = tabs->tabBar()->tabTextColor(5); connect(tabs, SIGNAL(currentChanged(int)), SLOT(onTabSelected(int))); QVBoxLayout *vbl = new QVBoxLayout(); vbl->setContentsMargins(0,0,0,0); vbl->addWidget(tabs); ui->centralWidget->setContentsMargins(0,0,0,0); ui->centralWidget->setLayout(vbl); //---- Toolbars -------------------------------- QToolBar *fileTB = new QToolBar("Fileops", this); QToolBar *playerTB = new QToolBar("Playback", this); QToolBar *toolsTB = new QToolBar("Toolset", this); fileTB ->setFloatable(false); playerTB->setFloatable(false); toolsTB ->setFloatable(false); fileTB->addAction(ui->actionSave); fileTB->addAction(ui->actionSave_audio_as); fileTB->addAction(ui->actionUndo); fileTB->addAction(ui->actionRedo); playerTB->addAction(ui->actionPlay); playerTB->addAction(ui->actionStop); playerTB->addAction(ui->actionBack); playerTB->addAction(ui->actionRepeat); volume = new QSlider(Qt::Horizontal, this); volume->setMaximum(100); volume->setSingleStep(1); volume->setPageStep(1); volume->setValue(settings.value(c_key_sound, 50).toInt()); volume->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); connect(playerTB, SIGNAL(orientationChanged(Qt::Orientation)), volume, SLOT(setOrientation(Qt::Orientation))); muteBtn = new QAction(QIcon(c_icon_sound), "", this); muteBtn->setCheckable(true); connect(muteBtn, SIGNAL(toggled(bool)), SLOT(onMute(bool))); playerTB->addWidget(volume); playerTB->addAction(muteBtn); QComboBox *quantizeCombo = new QComboBox(this); QComboBox *lengthCombo = new QComboBox(this); quantizeCombo->addItems(QStringList() << "Q/4" << "Q/8" << "Q/16" << "Q/32" << "Q/64"); lengthCombo ->addItems(QStringList() << "♪/4" << "♪/8" << "♪/16" << "♪/32" << "♪/64"); quantizeCombo->setCurrentIndex(3); lengthCombo ->setCurrentIndex(3); toolsTB->addAction(ui->actionEdit_Mode); toolsTB->addAction(ui->actionGrid_Snap); toolsTB->addSeparator(); toolsTB->addWidget(quantizeCombo); toolsTB->addWidget(lengthCombo); addToolBar(fileTB); addToolBar(playerTB); addToolBar(toolsTB); toolbars.append(fileTB); toolbars.append(playerTB); toolbars.append(toolsTB); //---------------------------------------------- connect(quantizeCombo, SIGNAL(currentIndexChanged(int)), SLOT(onQuantizeSelected(int))); connect(lengthCombo, SIGNAL(currentIndexChanged(int)), SLOT(onNotelengthSelected(int))); connect(vsLog::instance(), &vsLog::message, this, &MainWindow::onLog); connect(piano, &qtauPiano ::heightChanged, this, &MainWindow::onPianoHeightChanged); connect(noteEditor, &qtauNoteEditor ::widthChanged, this, &MainWindow::onNoteEditorWidthChanged); connect(meter, &qtauMeterBar ::scrolled, this, &MainWindow::notesHScrolled); connect(piano, &qtauPiano ::scrolled, this, &MainWindow::notesVScrolled); connect(drawZone, &qtauDynDrawer ::scrolled, this, &MainWindow::notesHScrolled); connect(noteEditor, &qtauNoteEditor ::vscrolled, this, &MainWindow::notesVScrolled); connect(noteEditor, &qtauNoteEditor ::hscrolled, this, &MainWindow::notesHScrolled); connect(vocalWave, &qtauWaveform ::scrolled, this, &MainWindow::notesHScrolled); connect(musicWave, &qtauWaveform ::scrolled, this, &MainWindow::notesHScrolled); connect(vscr, &QScrollBar ::valueChanged, this, &MainWindow::vertScrolled); connect(hscr, &QScrollBar ::valueChanged, this, &MainWindow::horzScrolled); connect(noteEditor, &qtauNoteEditor ::rmbScrolled, this, &MainWindow::onEditorRMBScrolled); connect(noteEditor, &qtauNoteEditor ::requestsOffset, this, &MainWindow::onEditorRequestOffset); connect(zoom, &QSlider ::valueChanged, this, &MainWindow::onZoomed); connect(meter, &qtauMeterBar ::zoomed, this, &MainWindow::onEditorZoomed); connect(noteEditor, &qtauNoteEditor ::zoomed, this, &MainWindow::onEditorZoomed); connect(drawZone, &qtauDynDrawer ::zoomed, this, &MainWindow::onEditorZoomed); connect(vocalWave, &qtauWaveform ::zoomed, this, &MainWindow::onEditorZoomed); connect(musicWave, &qtauWaveform ::zoomed, this, &MainWindow::onEditorZoomed); connect(ui->actionQuit, &QAction::triggered, [=]() { this->close(); }); connect(ui->actionOpen, &QAction::triggered, this, &MainWindow::onOpenUST); connect(ui->actionSave, &QAction::triggered, this, &MainWindow::onSaveUST); connect(ui->actionSave_as, &QAction::triggered, this, &MainWindow::onSaveUSTAs); connect(ui->actionUndo, &QAction::triggered, this, &MainWindow::onUndo); connect(ui->actionRedo, &QAction::triggered, this, &MainWindow::onRedo); connect(ui->actionDelete, &QAction::triggered, this, &MainWindow::onDelete); connect(ui->actionEdit_Mode, &QAction::triggered, this, &MainWindow::onEditMode); connect(ui->actionGrid_Snap, &QAction::triggered, this, &MainWindow::onGridSnap); connect(ui->actionSave_audio_as, &QAction::triggered, this, &MainWindow::onSaveAudioAs); //---------------------------------------------- lastScoreDir = settings.value(c_key_dir_score, "").toString(); lastAudioDir = settings.value(c_key_dir_audio, "").toString(); audioExt = settings.value(c_key_audio_codec, "").toString(); showNewLogNumber = settings.value(c_key_show_lognum, true).toBool(); if (!settings.value(c_key_dynpanel_on, true).toBool()) { QList<int> panelSizes = editorSplitter->sizes(); panelSizes.last() = 0; editorSplitter->setSizes(panelSizes); } if (settings.value(c_key_win_max, false).toBool()) showMaximized(); else { QRect winGeom = geometry(); QRect setGeom = settings.value(c_key_win_size, QRect(winGeom.topLeft(), minimumSize())).value<QRect>(); if (setGeom.width() >= winGeom.width() && setGeom.height() >= setGeom.height()) setGeometry(setGeom); } //---------------------------------------------- vsLog::instance()->enableHistory(false); onLog(QString("\t%1 %2 @ %3").arg(tr("Launching QTau")).arg(c_qtau_ver).arg(__DATE__), ELog::success); onLog("\t---------------------------------------------", ELog::info); vsLog::r(); // print stored messages from program startup onLog("\t---------------------------------------------", ELog::info); vsLog::n(); }
void MTDetailEdit::dialog(MTDetailEdit::DetailEditType theType, bool bIsModal/*=false*/) { if (m_bFirstRun) { m_bFirstRun = false; // ------------------------------------------- ui->tableWidget->setColumnCount(2); ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); // ------------------------------------------- ui->tableWidget->horizontalHeader()->resizeSection(0, 5); // ------------------------------------------- ui->tableWidget->horizontalHeader()->setStretchLastSection(true); ui->tableWidget->verticalHeader()->setDefaultSectionSize(60); ui->tableWidget->verticalHeader()->hide(); ui->tableWidget->horizontalHeader()->hide(); // ------------------------------------------- ui->tableWidget->setContentsMargins(10,0,0,0); // ------------------------------------------- ui->tableWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding); // ---------------------------------- m_pTabWidget = new QTabWidget; // ---------------------------------- m_pTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_pTabWidget->setContentsMargins(5, 5, 5, 5); // ---------------------------------- QWidget * pTab1 = new QWidget; // ---------------------------------- pTab1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pTab1->setContentsMargins(5, 5, 5, 5); // ---------------------------------- m_pTabWidget->addTab(pTab1, tr("Details")); // ------------------------------------------- // Instantiate m_pDetailPane to one of various types. // m_Type = theType; switch (m_Type) { case MTDetailEdit::DetailEditTypeNym: m_pDetailPane = new MTNymDetails(this, *this); break; case MTDetailEdit::DetailEditTypeContact: m_pDetailPane = new MTContactDetails(this, *this); break; case MTDetailEdit::DetailEditTypeServer: m_pDetailPane = new MTServerDetails(this, *this); break; case MTDetailEdit::DetailEditTypeAsset: m_pDetailPane = new MTAssetDetails(this, *this); break; case MTDetailEdit::DetailEditTypeAccount: m_pDetailPane = new MTAccountDetails(this, *this); // ------------------------------------------- connect(m_pDetailPane, SIGNAL(DefaultAccountChanged(QString, QString)), m_pMoneychanger, SLOT (setDefaultAccount(QString, QString))); // ------------------------------------------- // connect(m_pDetailPane, SIGNAL(cashBalanceChanged()), // m_pMoneychanger, SLOT (onCashBalanceChanged())); // // ------------------------------------------- // connect(m_pDetailPane, SIGNAL(acctBalanceChanged()), // m_pMoneychanger, SLOT (onAcctBalanceChanged())); // // ------------------------------------------- break; default: qDebug() << "MTDetailEdit::dialog: MTDetailEdit::DetailEditTypeError"; return; } // ------------------------------------------- m_pDetailPane->SetOwnerPointer(*this); // ------------------------------------------- m_pDetailLayout = new QVBoxLayout; m_pDetailLayout->addWidget(m_pDetailPane); m_pDetailPane ->setContentsMargins(1,1,1,1); m_pDetailLayout->setContentsMargins(1,1,1,1); // ---------------------------------- pTab1->setLayout(m_pDetailLayout); // ---------------------------------- int nCustomTabCount = m_pDetailPane->GetCustomTabCount(); if (nCustomTabCount > 0) { for (int ii = 0; ii < nCustomTabCount; ii++) { QWidget * pTab = m_pDetailPane->CreateCustomTab(ii); // ---------------------------------- if (NULL != pTab) { pTab->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pTab->setContentsMargins(5, 5, 5, 5); QString qstrTabName = m_pDetailPane->GetCustomTabName(ii); m_pTabWidget->addTab(pTab, qstrTabName); } // ---------------------------------- } } // ----------------------------------------------- QGridLayout * pGridLayout = new QGridLayout; pGridLayout->addWidget(m_pTabWidget); pGridLayout->setContentsMargins(0,0,0,0); m_pTabWidget->setTabPosition(QTabWidget::South); // ---------------------------------- ui->widget->setContentsMargins(1,1,1,1); // ---------------------------------- ui->widget->setLayout(pGridLayout); // ---------------------------------- } // first run. // ------------------------------------------- RefreshRecords(); // ------------------------------------------- // if (m_map.size() < 1) // on_addButton_clicked(); // ------------------------------------------- if (bIsModal) { QDialog theDlg; theDlg.setWindowTitle(this->windowTitle()); // theDlg.installEventFilter(this); QVBoxLayout * pLayout = new QVBoxLayout; pLayout->addWidget(this); theDlg.setLayout(pLayout); theDlg.setWindowFlags(Qt::Tool); // A hack so it will show the close button. theDlg.exec(); pLayout->removeWidget(this); } else { this->installEventFilter(this); show(); setFocus(); } // ------------------------------------------- }