ToolBox::ToolBox(QWidget *parentWidget) : Utils::StyledBar(parentWidget), m_leftToolBar(new QToolBar("LeftSidebar", this)), m_rightToolBar(new QToolBar("RightSidebar", this)) { setMaximumHeight(44); setSingleRow(false); QFrame *frame = new QFrame(this); m_crumblePath = new Utils::CrumblePath(frame); frame->setStyleSheet("background-color: #4e4e4e;"); frame->setFrameShape(QFrame::NoFrame); QHBoxLayout *layout = new QHBoxLayout(frame); layout->setMargin(0); layout->setSpacing(0); frame->setLayout(layout); layout->addWidget(m_crumblePath); frame->setProperty("panelwidget", true); frame->setProperty("panelwidget_singlerow", false); QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setMargin(0); verticalLayout->setSpacing(0); QHBoxLayout *horizontalLayout = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout); verticalLayout->addWidget(frame); horizontalLayout->setMargin(0); horizontalLayout->setSpacing(0); m_leftToolBar->setFloatable(true); m_leftToolBar->setMovable(true); m_leftToolBar->setOrientation(Qt::Horizontal); m_leftToolBar->setIconSize(QSize(24, 24)); QToolBar *stretchToolbar = new QToolBar(this); setSingleRow(false); m_leftToolBar->setProperty("panelwidget", true); m_leftToolBar->setProperty("panelwidget_singlerow", false); m_rightToolBar->setProperty("panelwidget", true); m_rightToolBar->setProperty("panelwidget_singlerow", false); stretchToolbar->setProperty("panelwidget", true); stretchToolbar->setProperty("panelwidget_singlerow", false); stretchToolbar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_rightToolBar->setOrientation(Qt::Horizontal); m_rightToolBar->setIconSize(QSize(24, 24)); horizontalLayout->addWidget(m_leftToolBar); horizontalLayout->addWidget(stretchToolbar); horizontalLayout->addWidget(m_rightToolBar); }
void MaterialAssignmentEditorWindow::append_row( QVBoxLayout* parent, QLayout* row_layout) { QFrame* row = new QFrame(); row->setProperty("hasFrame", true); row->setLayout(row_layout); parent->addWidget(row); }
QFrame *SettingsDocumentNumberingView::createTablesInterface() { QFrame *widget = new QFrame(); QGridLayout *layout = new QGridLayout(); widget->setLayout(layout); layout->addWidget(month = new Button(ButtonStruct("Miesiąc","Dodanie znacznika miesiąca", QSize(250,25))),0,2,1,1); layout->addWidget(day = new Button(ButtonStruct("Dzień","Dodanie znacznika dnia", QSize(250,25))),0,1,1,1); layout->addWidget(year = new Button(ButtonStruct("Rok","Dodanie znacznika roku", QSize(250,25))),1,1,1,1); layout->addWidget(numbering = new Button(ButtonStruct("Numeracja","Dodanie znacznika numeracji", QSize(250,25))),1,2,1,1); layout->addWidget(sign = new QLineEdit(),2,1,1,2); sign->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9]*"),sign)); widget->setFrameShape(QFrame::Box); widget->setFrameShadow(QFrame::Raised); widget->setProperty("whiteRoundFrame",true); return widget; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void AboutDialog::create() { // Only allowed to call once assert(!m_isCreated); // Only show app info if app name is non-empty bool showAppInfo = !m_appName.isEmpty(); // Do an initial resize, dialog will resize itself later based on the widgets we have added resize(10, 10); // Set caption, different text depending on whether we're showing app info or not QString dlgCaption = "Version Information Details"; if (showAppInfo) { dlgCaption = "About " + m_appName; if (m_isDebugBuild) dlgCaption += " (DEBUG)"; } setWindowTitle(dlgCaption); // Create the dialog's main layout QVBoxLayout* dlgMainLayout = new QVBoxLayout(this); // The the top layout QVBoxLayout* topLayout = new QVBoxLayout; topLayout->setSpacing(3); // Possibly create and set text for widgets with app info if (showAppInfo) { QVBoxLayout* appInfoLayout = new QVBoxLayout; appInfoLayout->setSpacing(3); // Always do app name assert(!m_appName.isEmpty()); QLabel* appNameLabel = new QLabel(this); QFont appNameFont(appNameLabel->font()); appNameFont.setPointSize(14); appNameFont.setBold(true); appNameLabel->setFont(appNameFont); appNameLabel->setText(m_appName); appInfoLayout->addWidget(appNameLabel); // Application version if specified if (!m_appVersion.isEmpty()) { QString appVer = m_appVersion; // appVer += cvf::System::is64Bit() ? " (64-bit)" : " (32-bit)"; QLabel* appVersionLabel = new QLabel(this); QFont appVersionFont(appVersionLabel->font()); appVersionFont.setPointSize(8); appVersionFont.setBold(TRUE); appVersionLabel->setFont(appVersionFont); appVersionLabel->setText(appVer); appInfoLayout->addWidget(appVersionLabel); } // Application copyright if specified if (!m_appCopyright.isEmpty()) { QLabel* appCopyrightLabel = new QLabel(this); QFont appCopyrightFont(appCopyrightLabel->font()); appCopyrightFont.setPointSize(8); appCopyrightFont.setBold(TRUE); appCopyrightLabel->setFont(appCopyrightFont); appCopyrightLabel->setText(m_appCopyright); appInfoLayout->addWidget(appCopyrightLabel); } QFrame* line = new QFrame(this); line->setProperty("frameShape", (int)QFrame::HLine); line->setFrameShadow(QFrame::Sunken); line->setFrameShape(QFrame::HLine); appInfoLayout->addWidget(line); topLayout->addLayout(appInfoLayout); } // Possibly show extend version info if (m_showQtVersion || m_verLabels.size() > 0) { QGridLayout* verInfoLayout = new QGridLayout; verInfoLayout->setSpacing(0); int insertRow = 0; // Qt version if (m_showQtVersion) { addStringPairToVerInfoLayout("Qt ver.: ", qVersion(), verInfoLayout, insertRow++); } // Custom specified labels if (m_verLabels.size() > 0) { assert(m_verLabels.size() == m_verTexts.size()); int i; for (i = 0; i < m_verLabels.size(); i++) { addStringPairToVerInfoLayout(m_verLabels[i], m_verTexts[i], verInfoLayout, insertRow++); } } topLayout->addLayout(verInfoLayout); } dlgMainLayout->addLayout(topLayout); QSpacerItem* spacer1 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); dlgMainLayout->addItem(spacer1); // The bottom part with the OK button and // possibly text label indicating that we're running a debug build QHBoxLayout* bottomLayout = new QHBoxLayout; // Indicate that this is a debug build if (m_isDebugBuild) { QLabel* debugLabel = new QLabel(this); debugLabel->setText("<font color='brown'><b>This is a DEBUG build...</b></font>"); bottomLayout->addWidget(debugLabel); } // Add OK button QSpacerItem* spacer2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); bottomLayout->addItem(spacer2); QPushButton* buttonOk = new QPushButton("&OK", this); buttonOk->setAutoDefault(TRUE); buttonOk->setDefault(TRUE); buttonOk->setFocus(); connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()) ); bottomLayout->addWidget(buttonOk); dlgMainLayout->addLayout(bottomLayout); m_isCreated = true; }
QWidget *MessageDisplayWidget::createNewRow(const QString &name, const QString &message/*, const QString ×tamp*/, int messageId, bool isOur) { OpacityWidget *widget = new OpacityWidget(this); widget->setProperty("class", "msgRow"); // for CSS styling ElideLabel *nameLabel = new ElideLabel(widget); nameLabel->setMaximumWidth(50); nameLabel->setTextElide(true); nameLabel->setTextElideMode(Qt::ElideRight); nameLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); nameLabel->setToolTip(name); nameLabel->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop); MessageLabel *messageLabel = new MessageLabel(widget); messageLabel->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop); QString messageText = EmoticonMenu::smile(urlify(message.toHtmlEscaped())).replace('\n', "<br>"); // Action if(messageId < -1) { QPalette actionPal; actionPal.setColor(QPalette::Foreground, Qt::darkGreen); messageLabel->setPalette(actionPal); messageLabel->setProperty("class", "msgAction"); // for CSS styling messageLabel->setText(QString("<i>%1</i>").arg(messageText)); } // Message else if (messageId != 0) { messageLabel->setMessageId(messageId); messageLabel->setProperty("class", "msgMessage"); // for CSS styling messageLabel->setText(messageText); } // Error else { QPalette errorPal; errorPal.setColor(QPalette::Foreground, Qt::red); messageLabel->setPalette(errorPal); messageLabel->setProperty("class", "msgError"); // for CSS styling messageLabel->setText(QString("<img src=\":/icons/error.png\" /> %1").arg(messageText)); messageLabel->setToolTip(tr("Couldn't send the message!")); } QLabel *timeLabel = new QLabel(widget); timeLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); timeLabel->setForegroundRole(QPalette::Mid); timeLabel->setProperty("class", "msgTimestamp"); // for CSS styling timeLabel->setAlignment(Qt::AlignRight | Qt::AlignTop | Qt::AlignTrailing); timeLabel->setText(QTime::currentTime().toString("hh:mm:ss")); // Insert name if sender changed. if (lastMessageIsOurs != isOur || mainlayout->count() < 1 || messageId < -1) { nameLabel->setText(name); if (isOur) { nameLabel->setForegroundRole(QPalette::Mid); nameLabel->setProperty("class", "msgUserName"); // for CSS styling } else { nameLabel->setProperty("class", "msgFriendName"); // for CSS styling } // Create line if (lastMessageIsOurs != isOur && mainlayout->count() > 0) { QFrame *line = new QFrame(this); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Plain); line->setForegroundRole(QPalette::Midlight); line->setProperty("class", "msgLine"); // for CSS styling mainlayout->addWidget(line); } lastMessageIsOurs = isOur; } // Return new line QHBoxLayout *hlayout = new QHBoxLayout(widget); hlayout->setContentsMargins(0, 0, 0, 0); hlayout->setMargin(0); hlayout->addWidget(nameLabel, 0, Qt::AlignTop); hlayout->addWidget(messageLabel, 0, Qt::AlignTop); hlayout->addWidget(timeLabel, 0, Qt::AlignTop); widget->setLayout(hlayout); return widget; }