void TabDialog::setupTab1() { QVBox *tab1 = new QVBox( this ); tab1->setMargin( 5 ); (void)new QLabel( "Filename:", tab1 ); QLineEdit *fname = new QLineEdit( filename, tab1 ); fname->setFocus(); (void)new QLabel( "Path:", tab1 ); QLabel *path = new QLabel( fileinfo.dirPath( TRUE ), tab1 ); path->setFrameStyle( QFrame::Panel | QFrame::Sunken ); (void)new QLabel( "Size:", tab1 ); QLabel *size = new QLabel( QString( "%1 KB" ).arg( fileinfo.size() ), tab1 ); size->setFrameStyle( QFrame::Panel | QFrame::Sunken ); (void)new QLabel( "Last Read:", tab1 ); QLabel *lread = new QLabel( fileinfo.lastRead().toString(), tab1 ); lread->setFrameStyle( QFrame::Panel | QFrame::Sunken ); (void)new QLabel( "Last Modified:", tab1 ); QLabel *lmodif = new QLabel( fileinfo.lastModified().toString(), tab1 ); lmodif->setFrameStyle( QFrame::Panel | QFrame::Sunken ); addTab( tab1, "General" ); }
void TabDialog::setupTab2() { QVBox *tab2 = new QVBox( this ); tab2->setMargin( 5 ); QButtonGroup *bg = new QButtonGroup( 1, QGroupBox::Horizontal, "Permissions", tab2 ); QCheckBox *readable = new QCheckBox( "Readable", bg ); if ( fileinfo.isReadable() ) readable->setChecked( TRUE ); QCheckBox *writable = new QCheckBox( "Writeable", bg ); if ( fileinfo.isWritable() ) writable->setChecked( TRUE ); QCheckBox *executable = new QCheckBox( "Executable", bg ); if ( fileinfo.isExecutable() ) executable->setChecked( TRUE ); QButtonGroup *bg2 = new QButtonGroup( 2, QGroupBox::Horizontal, "Owner", tab2 ); (void)new QLabel( "Owner", bg2 ); QLabel *owner = new QLabel( fileinfo.owner(), bg2 ); owner->setFrameStyle( QFrame::Panel | QFrame::Sunken ); (void)new QLabel( "Group", bg2 ); QLabel *group = new QLabel( fileinfo.group(), bg2 ); group->setFrameStyle( QFrame::Panel | QFrame::Sunken ); addTab( tab2, "Permissions" ); }
CursorView::CursorView() // construct view { static struct { QCursorShape shape; const char* name; // cursor name } list[] = { { ArrowCursor, "arrowCursor" }, { UpArrowCursor, "upArrowCursor" }, { CrossCursor, "crossCursor" }, { WaitCursor, "waitCursor" }, { IbeamCursor, "ibeamCursor" }, { SizeVerCursor, "sizeVerCursor" }, { SizeHorCursor, "sizeHorCursor" }, { SizeBDiagCursor, "sizeBDiagCursor" }, { SizeFDiagCursor, "sizeFDiagCursor" }, { SizeAllCursor, "sizeAllCursor" }, { BlankCursor, "blankCursor" }, { SplitVCursor, "splitVCursor" }, { SplitHCursor, "splitHCursor" }, { PointingHandCursor, "pointingHandCursor" }, { ForbiddenCursor, "forbiddenCursor" }, { BitmapCursor, "" } // sentinel }; setCaption( "CursorView" ); // set window caption QGridLayout* grid = new QGridLayout( this, 5, 4, 20 ); QLabel *label; int i=0; for ( int y=0; y<4; y++ ) { // create the small labels for ( int x=0; x<4; x++ ) { if ( list[i].shape == BitmapCursor ) break; label = new QLabel( this ); label->setCursor( QCursor( list[i].shape ) ); label->setText( list[i].name ); label->setAlignment( AlignCenter ); label->setFrameStyle( QFrame::Box | QFrame::Raised ); grid->addWidget( label, x, y ); i++; } } QBitmap cb( cb_width, cb_height, cb_bits, TRUE ); QBitmap cm( cm_width, cm_height, cm_bits, TRUE ); QCursor custom( cb, cm ); // create bitmap cursor label = new QLabel( this ); // create the big label label->setCursor( custom ); label->setText( "Custom bitmap cursor" ); label->setAlignment( AlignCenter ); label->setFrameStyle( QFrame::Box | QFrame::Sunken ); grid->addMultiCellWidget( label, 4, 4, 0, 3 ); }
EDATool::EDATool() { this->setWindowTitle(tr("EDATool")); boardScene = new QGraphicsScene(); boardView = new BoardView(this, boardScene); if (!QCoreApplication::arguments().contains("-nogl")) boardView->setViewport(new QGLWidget); QTabWidget *tabs = new QTabWidget(this); tabs->setFocusPolicy(Qt::NoFocus); // don't let the tab header itself steal focus tabs->addTab(boardView, QString("Document")); tabs->setDocumentMode(true); this->setCentralWidget(tabs); QDockWidget *temp = new QDockWidget(this); QTreeWidget *tree = new QTreeWidget(this); temp->setWindowTitle("Tool settings"); temp->setWidget(tree); tree->setColumnCount(1); tree->setHeaderLabel("Name"); this->addDockWidget(Qt::LeftDockWidgetArea, temp); this->fileMenu = this->menuBar()->addMenu(tr("File")); this->editMenu = this->menuBar()->addMenu(tr("Edit")); this->placeMenu = this->menuBar()->addMenu(tr("&Place")); QLabel *t = new QLabel("LOL FU"); t->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); this->statusBar()->addPermanentWidget(t); t = new QLabel("MOAR TESTING"); t->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); this->statusBar()->addPermanentWidget(t); this->statusBar()->showMessage("showmessage", 2000); resize(700, 500); //Board board; toolBar = addToolBar("Tools"); toolBar->setIconSize(QSize(16, 16)); toolActionGroup = new QActionGroup(this); SelectTool *selTool = new SelectTool(this); selTool->install(); RouteTool *tool = new RouteTool(this); tool->install(); cache = new QHash<QString, QGraphicsItemGroup*>(); QFile file("C:\\Users\\andreas\\workspace\\edatool\\test.brd"); EagleFormat *eagleFormat = new EagleFormat(); eagleFormat->read(&file,cache); QHashIterator<QString, QGraphicsItemGroup*> i(*cache); while (i.hasNext()) { i.next(); QTreeWidgetItem *item = new QTreeWidgetItem(tree, QStringList(i.key())); } connect(tree,SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this,SLOT(itemClicked(QTreeWidgetItem*,QTreeWidgetItem*))); }
//! [6] GeneralTab::GeneralTab(const QFileInfo &fileInfo, QWidget *parent) : QWidget(parent) { QLabel *fileNameLabel = new QLabel(tr("File Name:")); QLineEdit *fileNameEdit = new QLineEdit(fileInfo.fileName()); QLabel *pathLabel = new QLabel(tr("Path:")); QLabel *pathValueLabel = new QLabel(fileInfo.absoluteFilePath()); pathValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel *sizeLabel = new QLabel(tr("Size:")); qlonglong size = fileInfo.size()/1024; QLabel *sizeValueLabel = new QLabel(tr("%1 K").arg(size)); sizeValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel *lastReadLabel = new QLabel(tr("Last Read:")); QLabel *lastReadValueLabel = new QLabel(fileInfo.lastRead().toString()); lastReadValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel *lastModLabel = new QLabel(tr("Last Modified:")); QLabel *lastModValueLabel = new QLabel(fileInfo.lastModified().toString()); lastModValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QSlider* redSlider = new QSlider(Qt::Horizontal); redSlider->setTickPosition(QSlider::TicksBelow); redSlider->setTickInterval(5); QSlider* greenSlider = new QSlider(Qt::Horizontal); greenSlider->setTickPosition(QSlider::TicksBelow); greenSlider->setTickInterval(5); QSlider* blueSlider = new QSlider(Qt::Horizontal); blueSlider->setTickPosition(QSlider::TicksBelow); blueSlider->setTickInterval(5); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(fileNameLabel); mainLayout->addWidget(fileNameEdit); mainLayout->addWidget(pathLabel); mainLayout->addWidget(pathValueLabel); mainLayout->addWidget(sizeLabel); mainLayout->addWidget(sizeValueLabel); mainLayout->addWidget(lastReadLabel); mainLayout->addWidget(lastReadValueLabel); mainLayout->addWidget(lastModLabel); mainLayout->addWidget(lastModValueLabel); mainLayout->addWidget(redSlider); mainLayout->addWidget(greenSlider); mainLayout->addWidget(blueSlider); mainLayout->addStretch(1); setLayout(mainLayout); }
void MainWindow::show_about() { QDialog *aboutdialog = new QDialog(); int pSize = aboutdialog->font().pointSize(); aboutdialog->setWindowTitle("About"); aboutdialog->setFixedSize(pSize*30,pSize*17); QVBoxLayout *templayout = new QVBoxLayout(); templayout->setMargin(APP_MARGIN); QLabel *projectname = new QLabel(QString(APP_NAME) +"\t"+ QString(APP_VERS)); projectname->setFrameStyle(QFrame::Box | QFrame::Raised); projectname->setAlignment(Qt::AlignCenter); QLabel *projectauthors = new QLabel("Designed by: Taranov Alex\n\nFirst release was in 2014"); projectauthors->setWordWrap(true); projectauthors->setAlignment(Qt::AlignCenter); QLabel *hyperlink = new QLabel("<a href='mailto:[email protected]?subject=QVideoProcessing'>Contact us at [email protected]"); hyperlink->setToolTip("Will try to open your default mail client"); hyperlink->setOpenExternalLinks(true); hyperlink->setAlignment(Qt::AlignCenter); templayout->addWidget(projectname); templayout->addWidget(projectauthors); templayout->addWidget(hyperlink); aboutdialog->setLayout(templayout); aboutdialog->exec(); delete hyperlink; delete projectauthors; delete projectname; delete templayout; delete aboutdialog; }
void BGDialog::slotIdentifyScreens() { // Taken from PositionTab::showIdentify in kdebase/kcontrol/kicker/positiontab_impl.cpp for (unsigned s = 0; s < m_numScreens; s++) { QLabel *screenLabel = new QLabel(0, Qt::X11BypassWindowManagerHint); screenLabel->setObjectName("Screen Identify"); QFont identifyFont(KGlobalSettings::generalFont()); identifyFont.setPixelSize(100); screenLabel->setFont(identifyFont); screenLabel->setFrameStyle(QFrame::Panel); screenLabel->setFrameShadow(QFrame::Plain); screenLabel->setAlignment(Qt::AlignCenter); screenLabel->setNum(int(s + 1)); // BUGLET: we should not allow the identification to be entered again // until the timer fires. QTimer::singleShot(1500, screenLabel, SLOT(deleteLater())); QPoint screenCenter(QApplication::desktop()->screenGeometry(s).center()); QRect targetGeometry(QPoint(0, 0), screenLabel->sizeHint()); targetGeometry.moveCenter(screenCenter); screenLabel->setGeometry(targetGeometry); screenLabel->show(); } }
void Widget::build3x3frame(QFrame *box3x3frame, int rowStart, int colStart, int QMap) { box3x3frame->setFrameStyle(QFrame::Plain); box3x3frame->setFrameShape(QFrame::Box); QGridLayout* box3x3 = new QGridLayout(box3x3frame); box3x3->setSpacing(0); box3x3->setMargin(0); int x = rowStart%9; for (int i = 0; i < 3; ++i) { int y = colStart%9; for (int j = 0; j < 3; ++j) { QLabel* cell = new QLabel(""); cell->setAlignment(Qt::AlignCenter); //cell->setAlignment(Qt::AlignVCenter); if(QMap) originPointToCellMap.insert(QPair<int,int>(x,y++),cell); else resultPointToCellMap.insert(QPair<int,int>(x,y++),cell); cell->setFrameStyle(QFrame::Plain); cell->setFrameShape(QFrame::Box); cell->setMargin(5); box3x3->addWidget(cell,i,j,1,1); } x++; } }
void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout, QLabel *&label) { QPushButton *button = new QPushButton; QLabel *colorLabel = new QLabel; const char *name = obs_property_name(prop); long long val = obs_data_get_int(settings, name); QColor color = color_from_int(val); button->setText(QTStr("Basic.PropertiesWindow.SelectColor")); colorLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel); colorLabel->setText(color.name(QColor::HexArgb)); colorLabel->setPalette(QPalette(color)); colorLabel->setAutoFillBackground(true); colorLabel->setAlignment(Qt::AlignCenter); QHBoxLayout *subLayout = new QHBoxLayout; subLayout->setContentsMargins(0, 0, 0, 0); subLayout->addWidget(colorLabel); subLayout->addWidget(button); WidgetInfo *info = new WidgetInfo(this, prop, colorLabel); connect(button, SIGNAL(clicked()), info, SLOT(ControlChanged())); children.emplace_back(info); label = new QLabel(QT_UTF8(obs_property_description(prop))); layout->addRow(label, subLayout); }
StatusBar::StatusBar( QWidget* parent ) : QStatusBar( parent ) { // create labels QLabel* label; label = ( mLabels[ltCursorPosition] = new QLabel( this ) ); label->setToolTip( tr( "Cursor position" ) ); label = ( mLabels[ltSaveState] = new QLabel( this ) ); label->setToolTip( tr( "Modification state of file" ) ); label = ( mLabels[ltEOLMode] = new QLabel( this ) ); label->setToolTip( tr( "EOL mode" ) ); label = ( mLabels[ltIndentMode] = new QLabel( this ) ); label->setToolTip( tr( "Indentation mode" ) ); // add labels for ( int i = ltCursorPosition; i < ltIndentMode +1; i++ ) { label = mLabels[ i ]; addPermanentWidget( label ); label->setMargin( 2 ); label->setFrameStyle( QFrame::NoFrame ); label->setAttribute( Qt::WA_MacSmallSize ); } // force remove statusbar label frame setStyleSheet( "QStatusBar::item { border: 0px; }" ); // connections connect( this, SIGNAL( messageChanged( const QString& ) ), this, SLOT( setMessage( const QString& ) ) ); }
QLabel* RTIMULibDemo::getFixedPanel(QString text) { QLabel *label = new QLabel(text); label->setFrameStyle(QFrame::Panel); label->setFixedSize(QSize(100, 16)); return label; }
void CQTs_ChSkillsViewer::initialize(){ train = new QPushButton(tr("Show only trained")); train->setCheckable(true); connect(train,SIGNAL(released()),this,SLOT(showOnlyTrained())); // grid->addWidget(train,0,0,1,3); QVBoxLayout *vl = new QVBoxLayout(); vl->addWidget(train); QWidget *container = new QWidget(); QScrollArea *scroll = new QScrollArea(); scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); int rows=0;// number of rows before the skill list QGridLayout *grid = new QGridLayout(); for (int i = 0; i < eng->skillNum(); ++i) { QLabel *tLab = new QLabel(eng->skillData(i).myName()); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab);//[i*8+0] name grid->addWidget(tLab,i+rows,0); grid->addWidget(tLab= new QLabel("0"),i+rows,1); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab);//[i*8+1] d20 tLab->setFrameStyle(QFrame::Panel|QFrame::Raised); grid->addWidget(tLab= new QLabel("="),i+rows,2); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab); grid->addWidget(tLab= new QLabel("0"),i+rows,3); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab);//[i*8+3] abl mod grid->addWidget(tLab= new QLabel("+"),i+rows,4); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab); grid->addWidget(tLab= new QLabel("0"),i+rows,5); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab);//[i*8+5] ranks grid->addWidget(tLab= new QLabel("+"),i+rows,6); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab); grid->addWidget(tLab= new QLabel("0"),i+rows,7); tLab->setAlignment(Qt::AlignCenter); Labels.push_back(tLab);//[i*8+7] var mods } container->setLayout(grid); scroll->setWidget(container); scroll->setWidgetResizable(true); scroll->setMinimumWidth(300); vl->addWidget(scroll); setLayout(vl); }
LivePanel::LivePanel(QWidget *parent) : QWidget(parent) { QVBoxLayout *vboxLayout = new QVBoxLayout(this); vboxLayout->setSpacing(0); vboxLayout->setMargin(0); splitter = new QSplitter(this); splitter->setOrientation(Qt::Vertical); splitter->setOpaqueResize(false); vboxLayout->addWidget(splitter); QListView *listView = new QListView(splitter); //listView1->setSizePolicy(* new QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum)); //listView1->setGeometry(0,0,400,300); QFrame *frame = new QFrame(splitter); frame->setStyleSheet("background-color:white"); //QMessageBox::about(this,QString::number(frame1->width()),""); //frame1->resize(frame1->width(),frame1->width()*3/4); frame->resize(256,192); //frame1->setFrameStyle(QFrame::Raised); QLabel *label = new QLabel(frame); label->setGeometry(10,10,400,300); label->setFrameStyle(QFrame::Box); label->setStyleSheet("background-color:green"); label->setText("<html><head><body><center><h1>上山打老虎 1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br><h1></center></body></html>"); }
int main(int argc, char** argv) { QApplication app(argc, argv); QWidget wgt; wgt.setWindowTitle("LineEdit"); QLabel* plblDisplay = new QLabel; plblDisplay->setFrameStyle(QFrame::Box | QFrame::Raised); plblDisplay->setLineWidth(2); plblDisplay->setFixedHeight(50); QLabel* plblText = new QLabel("&Text"); QLineEdit* ptxt = new QLineEdit; plblText->setBuddy(ptxt); QObject::connect(ptxt, SIGNAL(textChanged(const QString&)), plblDisplay, SLOT(setText(const QString&))); QLabel* plblPassword = new QLabel("&Password"); QLineEdit* ptxtPassword = new QLineEdit; plblPassword->setBuddy(ptxtPassword); ptxtPassword->setEchoMode(QLineEdit::Password); QObject::connect(ptxtPassword, SIGNAL(textChanged(const QString&)), plblDisplay, SLOT(setText(const QString&))); QVBoxLayout* pvbxLayout = new QVBoxLayout; pvbxLayout->addWidget(plblDisplay); pvbxLayout->addWidget(plblText); pvbxLayout->addWidget(ptxt); pvbxLayout->addWidget(plblPassword); pvbxLayout->addWidget(ptxtPassword); wgt.setLayout(pvbxLayout); wgt.show(); return app.exec(); }
void MainWindow::about() { QDialog *aboutdialog = new QDialog(); int pSize = aboutdialog->font().pointSize(); aboutdialog->setWindowTitle("About"); aboutdialog->setFixedSize(pSize*27,pSize*17); QVBoxLayout *templayout = new QVBoxLayout(); templayout->setMargin(5); QLabel *projectname = new QLabel(QString(APP_NAME) +"\t"+ QString(APP_VERSION)); projectname->setFrameStyle(QFrame::Box | QFrame::Raised); projectname->setAlignment(Qt::AlignCenter); QLabel *projectauthors = new QLabel(QString(APP_DESIGNER) + "\n\nBMSTU\n\nNovember of 2015"); projectauthors->setWordWrap(true); projectauthors->setAlignment(Qt::AlignCenter); QLabel *hyperlink = new QLabel("<a href='mailto:[email protected]?subject=Pointmetry'>Contact us at [email protected]"); hyperlink->setOpenExternalLinks(true); hyperlink->setAlignment(Qt::AlignCenter); templayout->addWidget(projectname); templayout->addWidget(projectauthors); templayout->addWidget(hyperlink); aboutdialog->setLayout(templayout); aboutdialog->exec(); delete hyperlink; delete projectauthors; delete projectname; delete templayout; delete aboutdialog; }
void QmitkToolTrackingStatusWidget::ShowStatusLabels() { RemoveGuiLabels(); if(m_NavigationDatas == NULL || m_NavigationDatas->size() <= 0) return; m_StatusLabels = new QVector<QLabel*>(); mitk::NavigationData* navData; QLabel* label; for(unsigned int i = 0; i < m_NavigationDatas->size(); i++) { navData = m_NavigationDatas->at(i).GetPointer(); QString name(navData->GetName()); label = new QLabel(name, this); label->setObjectName(name); label->setAlignment(m_Alignment | Qt::AlignVCenter); label->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_StatusLabels->append(label); if (m_Style == QmitkToolTrackingStatusWidget::VerticalUpperStyle) m_Controls->m_VerticalLayout->addWidget(m_StatusLabels->at(i)); else m_Controls->m_GridLayout->addWidget(m_StatusLabels->at(i),0,i); } }
void TransmitPAWidget::createGainGroup() { // QLabel *dBmLabel = new QLabel("dBm", this); // dBmLabel->setFrameStyle(QFrame::Box | QFrame::Raised); // dBmLabel->setStyleSheet(set->getLabelStyle()); // band label QStringList bandNames; bandNames << "2200m" << "630m" << "160 m" << "80 m" << "60 m" << "40 m" << "30 m" << "20 m" << "17 m" << "15 m" << "12 m" << "10 m" << "6 m" << "gen"; QList<QLabel *> bandLabelList; for (int i = 0; i < MAX_BANDS-1; i++) { QLabel *label = new QLabel(bandNames.at(i), this); label->setFrameStyle(QFrame::Box | QFrame::Raised); label->setStyleSheet(set->getLabelStyle()); bandLabelList << label; } // gain spinBox list for (int i = 0; i < MAX_BANDS-1; i++) { QDoubleSpinBox *spinBox = new QDoubleSpinBox(); spinBox->setStyleSheet(set->getComboBoxStyle()); spinBox->setMinimum(38.8); spinBox->setMaximum(100.0); spinBox->setSingleStep(0.1); spinBox->setStyleSheet(set->getDoubleSpinBoxStyle()); //CHECKED_CONNECT(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setAttenuatorValue(int))); gainSpinBoxList << spinBox; } QGridLayout* grid = new QGridLayout(this); grid->setVerticalSpacing(1); grid->setHorizontalSpacing(1); grid->setContentsMargins(7, 7, 5, 7); //grid->addWidget(attnLabel, 0, 0, 1, 2, Qt::AlignCenter); //grid->addWidget(emptyLabel1, 0, 2, 1, 1, Qt::AlignCenter); for (int i = 0; i < MAX_BANDS-1; i++) { grid->addWidget(bandLabelList.at(i), i+1, 0, 1, 1, Qt::AlignLeft); grid->addWidget(gainSpinBoxList.at(i), i+1, 1, 1, 1, Qt::AlignCenter); //grid->addWidget(dBmLabel, i+1, 3, 1, 1, Qt::AlignLeft); } gainGroup = new QGroupBox(tr("Gain by Band (dB)"), this); gainGroup->setMinimumWidth(m_minimumGroupBoxWidth); gainGroup->setLayout(grid); gainGroup->setStyleSheet(set->getWidgetStyle()); gainGroup->setFont(QFont("Arial", 8)); }
void TransmitOptionsWidget::createTransmitFilterGroup() { QLabel* highLabel = new QLabel("High (Hz):", this); highLabel->setFrameStyle(QFrame::Box | QFrame::Raised); highLabel->setStyleSheet(set->getLabelStyle()); QLabel* lowLabel = new QLabel("Low (Hz):", this); lowLabel->setFrameStyle(QFrame::Box | QFrame::Raised); lowLabel->setStyleSheet(set->getLabelStyle()); highFilterSpinBox = new QSpinBox(this); highFilterSpinBox->setMinimum(1000); highFilterSpinBox->setMaximum(5000); highFilterSpinBox->setStyleSheet(set->getSpinBoxStyle()); highFilterSpinBox->setValue(3100); lowFilterSpinBox = new QSpinBox(this); lowFilterSpinBox->setMinimum(0); lowFilterSpinBox->setMaximum(1000); lowFilterSpinBox->setStyleSheet(set->getSpinBoxStyle()); lowFilterSpinBox->setValue(200); QHBoxLayout *hbox1 = new QHBoxLayout(); hbox1->setSpacing(4); hbox1->addWidget(highLabel); hbox1->addStretch(); hbox1->addWidget(highFilterSpinBox); QHBoxLayout *hbox2 = new QHBoxLayout(); hbox2->setSpacing(4); hbox2->addWidget(lowLabel); hbox2->addStretch(); hbox2->addWidget(lowFilterSpinBox); QVBoxLayout *vbox = new QVBoxLayout(); vbox->setSpacing(4); vbox->addSpacing(6); vbox->addLayout(hbox1); vbox->addLayout(hbox2); transmitFilterGroup = new QGroupBox(tr("Transmit Filter"), this); transmitFilterGroup->setMinimumWidth(m_minimumGroupBoxWidth); transmitFilterGroup->setLayout(vbox); transmitFilterGroup->setStyleSheet(set->getWidgetStyle()); transmitFilterGroup->setFont(QFont("Arial", 8)); }
//! [3] QLabel *Window::createLabel(const QString &text) { QLabel *label = new QLabel(text); label->setAlignment(Qt::AlignCenter); label->setMargin(2); label->setFrameStyle(QFrame::Box | QFrame::Sunken); return label; }
//! [7] PermissionsTab::PermissionsTab(const QFileInfo &fileInfo, QWidget *parent) : QWidget(parent) { QGroupBox *permissionsGroup = new QGroupBox(tr("Permissions")); QCheckBox *readable = new QCheckBox(tr("Readable")); if (fileInfo.isReadable()) readable->setChecked(true); QCheckBox *writable = new QCheckBox(tr("Writable")); if ( fileInfo.isWritable() ) writable->setChecked(true); QCheckBox *executable = new QCheckBox(tr("Executable")); if ( fileInfo.isExecutable() ) executable->setChecked(true); QGroupBox *ownerGroup = new QGroupBox(tr("Ownership")); QLabel *ownerLabel = new QLabel(tr("Owner")); QLabel *ownerValueLabel = new QLabel(fileInfo.owner()); ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel *groupLabel = new QLabel(tr("Group")); QLabel *groupValueLabel = new QLabel(fileInfo.group()); groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QVBoxLayout *permissionsLayout = new QVBoxLayout; permissionsLayout->addWidget(readable); permissionsLayout->addWidget(writable); permissionsLayout->addWidget(executable); permissionsGroup->setLayout(permissionsLayout); QVBoxLayout *ownerLayout = new QVBoxLayout; ownerLayout->addWidget(ownerLabel); ownerLayout->addWidget(ownerValueLabel); ownerLayout->addWidget(groupLabel); ownerLayout->addWidget(groupValueLabel); ownerGroup->setLayout(ownerLayout); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(permissionsGroup); mainLayout->addWidget(ownerGroup); mainLayout->addStretch(1); setLayout(mainLayout); }
void npc_text_view::setView(int id) { setLayout(new QVBoxLayout{}); std::multimap<int,std::tuple<float,QString,QString>> * l_map = m_dbcache->get_npc_text_resource(); // loop through all the texts and present with probability for(auto it = l_map->lower_bound(id); it != l_map->upper_bound(id); ++it) { float p = std::get<0>((*it).second); QString t0 = std::get<1>((*it).second); QString t1 = std::get<2>((*it).second); int a = (t0.length()!=0) + (t1.length()!=0)*2; int c = (t0.length()!=0) + (t1.length()!=0); QGroupBox * box = new QGroupBox(QString::number(p*100) + QString("%")); box->setLayout(new QHBoxLayout{}); layout()->addWidget(box); switch(c) { case 1: // Present only one of the texts { QLabel * label = new QLabel{}; label->setMaximumWidth(400); label->setWordWrap(true); label->setFrameStyle(QFrame::Panel | QFrame::Sunken); box->layout()->addWidget(label); if(a==1) // t0 isnt empty { label->setText(t0); } if(a==2) // t1 isnt empty { label->setText(t1); } label->setAlignment(Qt::AlignCenter); break; } case 2: // Present both of the texts { QLabel * label0 = new QLabel{t0}; label0->setMaximumWidth(400); label0->setWordWrap(true); QLabel * labelOR = new QLabel{" or "}; labelOR->setMaximumWidth(20); QLabel * label1 = new QLabel{t1}; label1->setMaximumWidth(400); label1->setWordWrap(true); label0->setFrameStyle(QFrame::Panel | QFrame::Sunken); label1->setFrameStyle(QFrame::Panel | QFrame::Sunken); box->layout()->addWidget(label0); box->layout()->addWidget(labelOR); box->layout()->addWidget(label1); break; } default: break; } } }
//状态栏 void mainWindow::showStateBar()//状态栏暂时只支持用代码创建 { ui->statusBar->showMessage(tr("欢迎使用数字图像处理软件"), 10000); QLabel* permanent = new QLabel(this); permanent->setFrameStyle(QFrame::Box | QFrame::Sunken); //permanent->setText("welcome to my blog: http://blog.csdn.net/learn_sunzhuli"); permanent->setText(tr("该数字图像处理软件基于QT, ITK, VTK, OPENCV开发!")); ui->statusBar->addPermanentWidget(permanent); }
void QmitkToolTrackingStatusWidget::AddEmptyLabel() { //add a label which tells that no tools are loaded yet QLabel* label = new QLabel("No tools loaded yet.", this); label->setObjectName("No tools loaded yet."); label->setAlignment(m_Alignment | Qt::AlignVCenter); label->setFrameStyle(QFrame::Panel | QFrame::Sunken); label->setStyleSheet("QLabel{background-color: #dddddd }"); if (m_Style == QmitkToolTrackingStatusWidget::VerticalUpperStyle) m_Controls->m_VerticalLayout->addWidget(label); else m_Controls->m_GridLayout->addWidget(label); }
QLabel* CToolClass::explanationLabel(QWidget* parent, const QString& heading, const QString& text ) { QString br; if (!heading.isEmpty()) { br = QString::fromLatin1("<BR/>"); } QLabel* label = new QLabel( QString::fromLatin1("<B>%1</B>%2%3").arg(heading).arg(br).arg(text),parent ); label->setWordWrap(true); label->setMargin(1); label->setFrameStyle(QFrame::Box | QFrame::Plain); return label; }
void IFormWidget::createLabel(const QString &text, Qt::Alignment horizAlign) { m_Label = new QLabel(); QLabel *l = m_Label; l->setFrameStyle(IFormWidget::ItemLabelFrame); // l->setFrameStyle(QFrame::Plain); // l->setFrameShape(QFrame::Box); l->setText(text); l->setAlignment(horizAlign); // l->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); l->setWordWrap(true); }
void QFStatusBar::addLabel() { //QList<QLabel*> lst = findChildren<QLabel*>(); //int ix = lst.count(); QBoxLayout *ly = qobject_cast<QBoxLayout*>(layout()); QF_ASSERT_EX(ly, "bad layout"); //ly->setMargin(0); QLabel *lbl = new QLabel(QString());//::number(labels.count())); lbl->setFrameStyle(QFrame::StyledPanel | QFrame::Plain); ly->insertWidget(labels.count(), lbl); labels << lbl; setProgressValue(-1); }
//! [6] GeneralTab::GeneralTab(const QFileInfo &fileInfo, QWidget *parent) : QWidget(parent) { QLabel *fileNameLabel = new QLabel(tr("File Name:")); QLineEdit *fileNameEdit = new QLineEdit(fileInfo.fileName()); QLabel *pathLabel = new QLabel(tr("Path:")); QLabel *pathValueLabel = new QLabel(fileInfo.absoluteFilePath()); pathValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel *sizeLabel = new QLabel(tr("Size:")); qlonglong size = fileInfo.size()/1024; QLabel *sizeValueLabel = new QLabel(tr("%1 K").arg(size)); sizeValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel *lastReadLabel = new QLabel(tr("Last Read:")); QLabel *lastReadValueLabel = new QLabel(fileInfo.lastRead().toString()); lastReadValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel *lastModLabel = new QLabel(tr("Last Modified:")); QLabel *lastModValueLabel = new QLabel(fileInfo.lastModified().toString()); lastModValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(fileNameLabel); mainLayout->addWidget(fileNameEdit); mainLayout->addWidget(pathLabel); mainLayout->addWidget(pathValueLabel); mainLayout->addWidget(sizeLabel); mainLayout->addWidget(sizeValueLabel); mainLayout->addWidget(lastReadLabel); mainLayout->addWidget(lastReadValueLabel); mainLayout->addWidget(lastModLabel); mainLayout->addWidget(lastModValueLabel); mainLayout->addStretch(1); setLayout(mainLayout); }
void toResultItem::setValue(QWidget *widget, const QString &title, const QString &value) { QLabel *label = dynamic_cast<QLabel *>(widget); if (label) { if (title != "-") { label->setFrameStyle(StyledPanel | Sunken); label->setFont(DataFont); label->setTextInteractionFlags(Qt::TextSelectableByMouse); } else { label->setFrameStyle(NoFrame); label->setFont(qApp->font()); } label->setText(value); if (Right) { label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); label->setWordWrap(true); } else { label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); label->setWordWrap(true); } } Result->addWidget(widget, (int) WidgetPos / (Columns * 2), // row WidgetPos % (Columns * 2)); // column }
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(tr("About ") + getDefaultSettings().getAppName()); setStyleSheet("font: bold 9pt"); // Buttons QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); QLabel* versionLabel = new QLabel(getVersionText()); versionLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel* schemaLabel = new QLabel(getSchemaVersionText()); schemaLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel* commitLabel = new QLabel(getCommitHash()); commitLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QLabel* openSSLLabel = new QLabel(getOpenSSLVersionText()); openSSLLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); QFormLayout* formLayout = new QFormLayout(); formLayout->addRow(tr("Version:"), versionLabel); formLayout->addRow(tr("Schema:"), schemaLabel); formLayout->addRow(tr("Commit:"), commitLabel); formLayout->addRow(tr("OpenSSL:"), openSSLLabel); QVBoxLayout* mainLayout = new QVBoxLayout(); mainLayout->setSizeConstraint(QLayout::SetNoConstraint); mainLayout->addLayout(formLayout); mainLayout->addSpacing(20); mainLayout->addWidget(new QLabel(getCopyrightText())); mainLayout->addWidget(buttonBox); setLayout(mainLayout); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // ptzComm = new PTZComm; target = new targetTracking; target->ptzComm->CommInit(); target-> ptzComm->PTZ_Init(); ui->infoDisplay->setTextColor(QColor(255,255,255)); ui->infoDisplay->setTextBackgroundColor(QColor(0,0,0)); QLabel *permanent = new QLabel(this); permanent->setFrameStyle(QFrame::Box|QFrame::Sunken); permanent->setText("*****@*****.**"); ui->statusBar->addPermanentWidget(permanent); /****************窗口美化部分***************************/ //setWindowFlags(windowFlags() | Qt::FramelessWindowHint| Qt::WindowStaysOnTopHint); /****************窗口背景********************************/ QPixmap pixmap = QPixmap("D:/bg3.jpg").scaled(this->size()); QPalette palette(this->palette()); palette.setBrush(QPalette::Background, QBrush(pixmap)); this->setPalette(palette); /**********PT相关控制部分******************************/ connect(this->ui->PTZ_home,&QPushButton::clicked,target->ptzComm,&PTZComm::Home); connect(this->ui->PTZ_left,&QPushButton::clicked,target->ptzComm,&PTZComm::Left); connect(this->ui->PTZ_right,&QPushButton::clicked,target->ptzComm,&PTZComm::Right); connect(this->ui->PTZ_up,&QPushButton::clicked,target->ptzComm,&PTZComm::Up); connect(this->ui->PTZ_down,&QPushButton::clicked,target->ptzComm,&PTZComm::Down); connect(this->ui->stop,&QPushButton::clicked,target->ptzComm,&PTZComm::Stop); ui->ZoomChange->setMinimum(0); ui->ZoomChange->setMaximum(128); ui->ZoomChange->setValue(0); ui->ZoomNumber->setMaximum(128); connect(this->ui->ZoomChange,&QSlider::valueChanged,target->ptzComm,&PTZComm::ZoomSet); connect(this->ui->ZoomChange,&QSlider::valueChanged,this->ui->ZoomNumber,&QSpinBox::setValue); connect(this->ui->comOpen,&QPushButton::clicked,target->ptzComm->comm,&MyThread::startCom); connect(this->ui->comClose,&QPushButton::clicked,target->ptzComm->comm,&MyThread::stop); ui->comNumber->setText(target->ptzComm->comm->portnum); /**********************跟踪控制部分**********************************/ connect(this->ui->startTracking,&QPushButton::clicked,target,&targetTracking::tracking); /***********************信息显示部分****************************/ connect(&this->target->ptzComm->comm->information,&info::getInfo,ui->infoDisplay,&QTextEdit::append); }