本文整理汇总了C++中setMinimumSize函数的典型用法代码示例。如果您正苦于以下问题:C++ setMinimumSize函数的具体用法?C++ setMinimumSize怎么用?C++ setMinimumSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setMinimumSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMinimumSize
void Window3D::setFixedSize(QSize size)
{
setMinimumSize(size);
setMaximumSize(size);
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
setMinimumSize(450, 480);
newGameMenu = menuBar()->addMenu("New game");
optionsMenu = menuBar()->addMenu("Options");
helpMenu = menuBar()->addMenu("Help");
easyGame = new QAction("Easy", this);
newGameMenu->addAction(easyGame);
connect(easyGame, SIGNAL(triggered()), this, SLOT(generateEasy()));
easyGame->setShortcut(Qt::CTRL + Qt::Key_1);
mediumGame = new QAction("Medium", this);
newGameMenu->addAction(mediumGame);
connect(mediumGame, SIGNAL(triggered()), this, SLOT(generateMedium()));
mediumGame->setShortcut(Qt::CTRL + Qt::Key_2);
hardGame = new QAction("Hard", this);
newGameMenu->addAction(hardGame);
connect(hardGame, SIGNAL(triggered()), this, SLOT(generateHard()));
hardGame->setShortcut(Qt::CTRL + Qt::Key_3);
/*randomGame = new QAction("Random", this);
newGameMenu->addAction(randomGame);
connect(randomGame, SIGNAL(triggered()), this, SLOT(generateRandom()));
randomGame->setShortcut(Qt::CTRL + Qt::Key_4);*/
solve = new QAction("Solve", this);
optionsMenu->addAction(solve);
connect(solve, SIGNAL(triggered()), this, SLOT(showSolution()));
solve->setShortcut(Qt::CTRL + Qt::Key_F);
stopSolving = new QAction("Stop solving", this);
optionsMenu->addAction(stopSolving);
connect(stopSolving, SIGNAL(triggered()), this, SLOT(solvingStopped()));
stopSolving->setShortcut(Qt::CTRL + Qt::Key_R);
previousMove = new QAction("Move back", this);
optionsMenu->addAction(previousMove);
connect(previousMove, SIGNAL(triggered()), this, SLOT(moveBack()));
previousMove->setShortcut(Qt::CTRL + Qt::Key_Z);
nextMove = new QAction("Move forward", this);
optionsMenu->addAction(nextMove);
connect(nextMove, SIGNAL(triggered()), this, SLOT(moveForward()));
nextMove->setShortcut(Qt::CTRL + Qt::Key_Y);
getInfo = new QAction("Instructions", this);
helpMenu->addAction(getInfo);
connect(getInfo, SIGNAL(triggered()), this, SLOT(showInstructions()));
getInfo->setShortcut(Qt::Key_F1);
gview = new Graphics();
setCentralWidget(gview);
scene = new QGraphicsScene();
scene->setBackgroundBrush(QColor("#e0e0e0"));
gview->setScene(scene);
gview->setEnabled(true);
counter = new QLabel();
for (int i = 1; i <= 15; i++)
tiles[i] = NULL;
srand(time(NULL));
gameBoard = NULL;
generateEasy();
statusBar()->addWidget(counter);
timer = new QTimer(this);
timer->setInterval(400);
connect(timer, SIGNAL(timeout()), this, SLOT(moveForward()));
}
示例3: QDialog
CreateUserDialog::CreateUserDialog(const QStringList &databases, const QString &serverName,
const QString &database, const MongoUser &user,
QWidget *parent) : QDialog(parent),
_user(user)
{
setWindowTitle("Add User");
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?)
setMinimumSize(minimumSize);
Indicator *serverIndicator = new Indicator(GuiRegistry::instance().serverIcon(), serverName);
Indicator *databaseIndicator = new Indicator(GuiRegistry::instance().databaseIcon(), database);
QFrame *hline = new QFrame();
hline->setFrameShape(QFrame::HLine);
hline->setFrameShadow(QFrame::Sunken);
_userNameLabel = new QLabel("Name:");
_userNameEdit = new QLineEdit();
_userNameEdit->setText(QtUtils::toQString(user.name()));
_userPassLabel = new QLabel("Password:");
_userPassEdit = new QLineEdit();
_userPassEdit->setEchoMode(QLineEdit::Password);
_userSourceLabel = new QLabel("UserSource:");
_userSourceComboBox = new QComboBox();
_userSourceComboBox->addItems(QStringList() << "" << databases); //setText(QtUtils::toQString(user.userSource()));
utils::setCurrentText(_userSourceComboBox, QtUtils::toQString(user.userSource()));
QGridLayout *gridRoles = new QGridLayout();
MongoUser::RoleType userRoles = user.role();
for (unsigned i = 0; i<RolesCount; ++i)
{
int row = i%3;
int col = i/3;
_rolesArray[i] = new QCheckBox(rolesText[i], this);
MongoUser::RoleType::const_iterator it = std::find(userRoles.begin(), userRoles.end(), rolesText[i]);
_rolesArray[i]->setChecked(it!= userRoles.end());
gridRoles->addWidget(_rolesArray[i], row, col);
}
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())));
VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())));
QHBoxLayout *hlayout = new QHBoxLayout();
hlayout->addStretch(1);
hlayout->addWidget(buttonBox);
QHBoxLayout *vlayout = new QHBoxLayout();
vlayout->addWidget(serverIndicator, 0, Qt::AlignLeft);
vlayout->addWidget(databaseIndicator, 0, Qt::AlignLeft);
vlayout->addStretch(1);
QGridLayout *namelayout = new QGridLayout();
namelayout->setContentsMargins(0, 7, 0, 7);
namelayout->addWidget(_userNameLabel, 0, 0);
namelayout->addWidget(_userNameEdit, 0, 1);
namelayout->addWidget(_userPassLabel, 1, 0);
namelayout->addWidget(_userPassEdit, 1, 1);
namelayout->addWidget(_userSourceLabel, 2, 0);
namelayout->addWidget(_userSourceComboBox, 2, 1);
namelayout->addLayout(gridRoles, 3, 1);
QVBoxLayout *layout = new QVBoxLayout();
layout->addLayout(vlayout);
layout->addWidget(hline);
layout->addLayout(namelayout);
layout->addLayout(hlayout);
setLayout(layout);
_userNameEdit->setFocus();
}
示例4: QDialog
CollectionDialog::CollectionDialog(SLManager *slm,int selC,QWidget *parent,const char *name) : QDialog(parent,name,TRUE)
{
setCaption(i18n("Collections Manager"));
ok=new KPushButton(KStdGuiItem::ok(),this);
ok->setGeometry(140,200,100,30);
connect(ok,SIGNAL(clicked()),SLOT(accept()) );
cancel=new KPushButton(KStdGuiItem::cancel(),this);
cancel->setGeometry(250,200,100,30);
connect(cancel,SIGNAL(clicked()),SLOT(reject()) );
label=new QLabel(i18n("Available collections:"),this);
label->adjustSize();
label->move(10,10);
collections=new QListBox(this,"collectionlist");
collections->setGeometry(10,20+label->height(),340,90);
connect(collections,SIGNAL(highlighted(int)),SLOT(collectionselected(int)));
connect(collections,SIGNAL(selected(int)),SLOT(changeCollectionName(int)));
slman=slm;
for (int i=0;i<=slman->numberOfCollections();i++)
{
collections->insertItem(i18n( slman->getCollectionName(i) ),i);
#ifdef COLLECTDLGDEBUG
printf("Name : %s\n",slman->getCollectionName(i));
#endif
};
selectedC=selC;
#ifdef COLLECTDLGDEBUG
printf("selectedC : %d\n",selectedC);
#endif
label2=new QLabel(i18n("Songs in selected collection:"),this);
label2->adjustSize();
label2->move(10,collections->y()+collections->height()+10);
songs=new QListBox(this,"songlist");
songs->setGeometry(10,label2->y()+label2->height()+10,340,120);
connect(songs,SIGNAL(highlighted(int)),SLOT(songselected(int)));
currentsl=slman->getCollection(selectedC);
if (slman->numberOfCollections()>0)
{
collections->setCurrentItem(selectedC);
collections->centerCurrentItem();
};
//fillInSongList();
newC=new QPushButton(i18n("&New..."),this);
newC->adjustSize();
newC->move(360,collections->y()+5);
connect(newC,SIGNAL(clicked()),SLOT(newCollection()) );
copyC=new QPushButton(i18n("&Copy..."),this);
copyC->adjustSize();
copyC->move(360,newC->y()+newC->height()+5);
connect(copyC,SIGNAL(clicked()),SLOT(copyCollection()) );
deleteC=new QPushButton(i18n("Delete"),this);
deleteC->adjustSize();
deleteC->move(360,copyC->y()+copyC->height()+5);
connect(deleteC,SIGNAL(clicked()),SLOT(deleteCollection()) );
addS=new QPushButton(i18n("&Add..."),this);
addS->adjustSize();
addS->move(360,songs->y()+5);
connect(addS,SIGNAL(clicked()),SLOT(addSong()) );
delS=new QPushButton(i18n("&Remove"),this);
delS->adjustSize();
delS->move(360,addS->y()+addS->height()+5);
connect(delS,SIGNAL(clicked()),SLOT(removeSong()) );
ok->move(ok->x(),songs->y()+songs->height()+10);
cancel->move(ok->x()+ok->width()+5,ok->y());
setMinimumSize(400,ok->y()+ok->height()+5);
//setMaximumSize(360,240);
}
示例5: QWidget
QgsLocatorWidget::QgsLocatorWidget( QWidget *parent )
: QWidget( parent )
, mLocator( new QgsLocator( this ) )
, mLineEdit( new QgsFilterLineEdit() )
, mLocatorModel( new QgsLocatorModel( this ) )
, mResultsView( new QgsLocatorResultsView() )
{
mLineEdit->setShowClearButton( true );
#ifdef Q_OS_MACX
mLineEdit->setPlaceholderText( tr( "Type to locate (⌘K)" ) );
#else
mLineEdit->setPlaceholderText( tr( "Type to locate (Ctrl+K)" ) );
#endif
int placeholderMinWidth = mLineEdit->fontMetrics().width( mLineEdit->placeholderText() );
int minWidth = std::max( 200, ( int )( placeholderMinWidth * 1.6 ) );
resize( minWidth, 30 );
QSizePolicy sizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
sizePolicy.setHorizontalStretch( 0 );
sizePolicy.setVerticalStretch( 0 );
setSizePolicy( sizePolicy );
setMinimumSize( QSize( minWidth, 0 ) );
QHBoxLayout *layout = new QHBoxLayout();
layout->setMargin( 0 );
layout->setContentsMargins( 0, 0, 0, 0 );
layout->addWidget( mLineEdit );
setLayout( layout );
setFocusProxy( mLineEdit );
// setup floating container widget
mResultsContainer = new QgsFloatingWidget( parent ? parent->window() : nullptr );
mResultsContainer->setAnchorWidget( mLineEdit );
mResultsContainer->setAnchorPoint( QgsFloatingWidget::BottomLeft );
mResultsContainer->setAnchorWidgetPoint( QgsFloatingWidget::TopLeft );
QHBoxLayout *containerLayout = new QHBoxLayout();
containerLayout->setMargin( 0 );
containerLayout->setContentsMargins( 0, 0, 0, 0 );
containerLayout->addWidget( mResultsView );
mResultsContainer->setLayout( containerLayout );
mResultsContainer->hide();
mProxyModel = new QgsLocatorProxyModel( mLocatorModel );
mProxyModel->setSourceModel( mLocatorModel );
mResultsView->setModel( mProxyModel );
mResultsView->setUniformRowHeights( true );
mResultsView->setIconSize( QSize( 16, 16 ) );
mResultsView->recalculateSize();
connect( mLocator, &QgsLocator::foundResult, this, &QgsLocatorWidget::addResult );
connect( mLocator, &QgsLocator::finished, this, &QgsLocatorWidget::searchFinished );
connect( mLineEdit, &QLineEdit::textChanged, this, &QgsLocatorWidget::scheduleDelayedPopup );
connect( mResultsView, &QAbstractItemView::activated, this, &QgsLocatorWidget::acceptCurrentEntry );
// have a tiny delay between typing text in line edit and showing the window
mPopupTimer.setInterval( 100 );
mPopupTimer.setSingleShot( true );
connect( &mPopupTimer, &QTimer::timeout, this, &QgsLocatorWidget::performSearch );
mFocusTimer.setInterval( 110 );
mFocusTimer.setSingleShot( true );
connect( &mFocusTimer, &QTimer::timeout, this, &QgsLocatorWidget::triggerSearchAndShowList );
mLineEdit->installEventFilter( this );
mResultsContainer->installEventFilter( this );
mResultsView->installEventFilter( this );
installEventFilter( this );
window()->installEventFilter( this );
mLocator->registerFilter( new QgsLocatorFilterFilter( this, this ) );
mMenu = new QMenu( this );
QAction *menuAction = mLineEdit->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/search.svg" ) ), QLineEdit::LeadingPosition );
connect( menuAction, &QAction::triggered, this, [ = ]
{
mFocusTimer.stop();
mResultsContainer->hide();
mMenu->exec( QCursor::pos() );
} );
connect( mMenu, &QMenu::aboutToShow, this, &QgsLocatorWidget::configMenuAboutToShow );
}
示例6: setFixedSize
void setFixedSize(QSize size)
{
setMinimumSize(size);
setMaximumSize(size);
}
示例7: QGLWidget
NavyPainter::NavyPainter(QWidget *parent, AutoLocation * location, int bgm) :
QGLWidget(parent), Navy(location)
{
setAutoFillBackground(false);
if(bgm >= 3 || bgm < 0)
bgm = 0;
bgcode = bgm;
t=0;
backgrounds.push_back(QImage(":/Skin1.png"));
backgrounds.push_back(QImage(":/Skin2.png"));
backgrounds.push_back(QImage(":/Island3min.png"));
bg= backgrounds[bgcode];
tt.load(":/reflection.jpg");
rr.load(":/boom.png");
mbg.load(":/images/background.png");
resize(m_w,m_h);
setMinimumSize(m_w,m_h);
setMaximumSize(m_w,m_h);
splash.load(":/images/splash.png");
boom.load(":/images/boom.png");
death.load(":/images/death.png");
timer = new QTimer(this);
timer->setInterval(25);
timer_fire = new QTimer(this);
//timer_fire->setInterval(100);
connect(timer, SIGNAL(timeout()), this, SLOT(animate()));
//connect(timer_fire, SIGNAL(timeout()), this, SLOT(fire()));
qsrand(::time(NULL));
timer->start();
show_shell = false;
setMouseTracking(true);
enemy = new Navy();
cur_sursor = false;
InitNoise();
wire_frame = normals = xold = yold = 0;
rotate_y = 35;
rotate_x = 10;
translate_z=2.5;
time = 0;
int flags = QGLFormat::openGLVersionFlags();
useOpenGl = (flags & QGLFormat::OpenGL_Version_2_0);
if(!useOpenGl)
timer->stop();
}
示例8: setMinimumSize
void
MyPluginGUI::createGUI(DefaultGUIModel::variable_t *var, int size)
{
setMinimumSize(200, 300); // Qt API for setting window size
//overall GUI layout with a "horizontal box" copied from DefaultGUIModel
QBoxLayout *layout = new QHBoxLayout(this);
//additional GUI layouts with "vertical" layouts that will later
// be added to the overall "layout" above
QBoxLayout *leftlayout = new QVBoxLayout();
//QBoxLayout *rightlayout = new QVBoxLayout();
// this is a "horizontal button group"
QHButtonGroup *bttnGroup = new QHButtonGroup("Button Panel:", this);
// we add two pushbuttons to the button group
QPushButton *aBttn = new QPushButton("Button A", bttnGroup);
QPushButton *bBttn = new QPushButton("Button B", bttnGroup);
// clicked() is a Qt signal that is given to pushbuttons. The connect()
// function links the clicked() event to a function that is defined
// as a "private slot:" in the header.
QObject::connect(aBttn, SIGNAL(clicked()), this, SLOT(aBttn_event()));
QObject::connect(bBttn, SIGNAL(clicked()), this, SLOT(bBttn_event()));
//these 3 utility buttons are copied from DefaultGUIModel
QHBox *utilityBox = new QHBox(this);
pauseButton = new QPushButton("Pause", utilityBox);
pauseButton->setToggleButton(true);
QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));
// add custom button group at the top of the layout
leftlayout->addWidget(bttnGroup);
// copied from DefaultGUIModel DO NOT EDIT
// this generates the text boxes and labels
QScrollView *sv = new QScrollView(this);
sv->setResizePolicy(QScrollView::AutoOneFit);
leftlayout->addWidget(sv);
QWidget *viewport = new QWidget(sv->viewport());
sv->addChild(viewport);
QGridLayout *scrollLayout = new QGridLayout(viewport, 1, 2);
size_t nstate = 0, nparam = 0, nevent = 0, ncomment = 0;
for (size_t i = 0; i < num_vars; i++)
{
if (vars[i].flags & (PARAMETER | STATE | EVENT | COMMENT))
{
param_t param;
param.label = new QLabel(vars[i].name, viewport);
scrollLayout->addWidget(param.label, parameter.size(), 0);
param.edit = new DefaultGUILineEdit(viewport);
scrollLayout->addWidget(param.edit, parameter.size(), 1);
QToolTip::add(param.label, vars[i].description);
QToolTip::add(param.edit, vars[i].description);
if (vars[i].flags & PARAMETER)
{
if (vars[i].flags & DOUBLE)
{
param.edit->setValidator(new QDoubleValidator(param.edit));
param.type = PARAMETER | DOUBLE;
}
else if (vars[i].flags & UINTEGER)
{
QIntValidator *validator = new QIntValidator(param.edit);
param.edit->setValidator(validator);
validator->setBottom(0);
param.type = PARAMETER | UINTEGER;
}
else if (vars[i].flags & INTEGER)
{
param.edit->setValidator(new QIntValidator(param.edit));
param.type = PARAMETER | INTEGER;
}
else
param.type = PARAMETER;
param.index = nparam++;
param.str_value = new QString;
}
else if (vars[i].flags & STATE)
{
param.edit->setReadOnly(true);
param.edit->setPaletteForegroundColor(Qt::darkGray);
param.type = STATE;
param.index = nstate++;
}
else if (vars[i].flags & EVENT)
{
param.edit->setReadOnly(true);
//.........这里部分代码省略.........
示例9: QWidget
//Le constructeur
Widget::Widget(): QWidget()
{
//On initialise la fenetre
this->setWindowTitle("Client B");
setMinimumSize(640,480);
//On crèe une table view non éditable
QTableView *tableView=new QTableView();
tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
//On crèe le model à 2 colonnes de la qtableview
this->model=new QStandardItemModel(0,2,tableView);
//On écrit l'entete du model
QStringList list;
list<<"Evenement"<<"Heure";
model->setHorizontalHeaderLabels(list);
//On affecte le model à sa qtableview, et on configure cette dernière
tableView->setModel(model);
tableView->horizontalHeader()->setStretchLastSection(true);
tableView->setColumnWidth(0,500);
//On range la qtableview dans la fenetre avec une layout
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(tableView);
this->setLayout(layout);
addRowToTable("Démarage de l'application",model);
//On créé la configuration réseau
ConfigurationNetwork *configurationNetwork=ConfigurationNetwork::createConfigurationNetwork("pchky",4321);
if(configurationNetwork) addRowToTable("La configuration réseau a été crée",model);
else {addRowToTable("Echec de la création de la configuration réseau",model);return;}
//On créé la configuration d'identification
ConfigurationIdentification *configurationIdentification=ConfigurationIdentification::createConfigurationIdentification("hky","hky");
if(configurationIdentification) addRowToTable("La configuration d'identification' a été crée",model);
else {addRowToTable("Echec de la création de la configuration d'indentification",model);return;}
//On créé la configuration de fichier
QList<Dir*> *depots=new QList<Dir*>();
Dir *d1=Dir::createDir("/home/julien/test/A","/sd/1");depots->append(d1);
if(!d1){addRowToTable("Echec de la création du repertoire 1",model);return;}
//Dir *d2=Dir::createDir("/home/hky/test/B","/sd/1");depots->append(d2);
//if(!d2){addRowToTable("Echec de la création du repertoire 2",model);return;}
ConfigurationFile *configurationFile=ConfigurationFile::createConfigurationFile(depots);
if(configurationFile) addRowToTable("Les configurations des repertoires surveillés ont été créés",model);
else {addRowToTable("Echec de la création des configurations de repertoires surveillés",model);return;}
//On créé la configuration totale
this->configurationData=ConfigurationData::createConfigurationData(configurationNetwork,configurationIdentification,configurationFile,"/home/julien/test/config2.xml");
//On créé l'interface réseau
this->networkInterface=NetworkInterface::createNetworkInterface(configurationData);
if(networkInterface) addRowToTable("L'interface réseau a été crée",model);
else {addRowToTable("Echec de la création de l'interface réseau",model);return;}
//On créé l'interface disque dur
this->hddInterface=HddInterface::createHddInterface(configurationData,networkInterface,model);
if(hddInterface) addRowToTable("L'interface disque a été crée",model);
else {addRowToTable("Echec de la création de l'interface disque",model);return;}
//On tente de se connecter au serveur
addRowToTable("Tentative de connexion au serveur",model);
bool a=networkInterface->connect();
if(a) addRowToTable("Success: Connexion réuissie",model);
else addRowToTable("Echec: Connexion échouée",model);
}
示例10: KDialogBase
KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, Kate::View *view )
: KDialogBase ( KDialogBase::TreeList,
i18n("Configure"),
KDialogBase::Ok | KDialogBase::Apply|KDialogBase::Cancel | KDialogBase::Help,
KDialogBase::Ok,
parent,
"configdialog" )
{
TDEConfig *config = KateApp::self()->config();
KWin::setIcons( winId(), KateApp::self()->icon(), KateApp::self()->miniIcon() );
actionButton( KDialogBase::Apply)->setEnabled( false );
mainWindow = parent;
setMinimumSize(600,400);
v = view;
pluginPages.setAutoDelete (false);
editorPages.setAutoDelete (false);
TQStringList path;
setShowIconsInTreeList(true);
path.clear();
path << i18n("Application");
setFolderIcon (path, SmallIcon("kate", TDEIcon::SizeSmall));
path.clear();
//BEGIN General page
path << i18n("Application") << i18n("General");
TQFrame* frGeneral = addPage(path, i18n("General Options"), BarIcon("go-home", TDEIcon::SizeSmall));
TQVBoxLayout *lo = new TQVBoxLayout( frGeneral );
lo->setSpacing(KDialog::spacingHint());
config->setGroup("General");
// GROUP with the one below: "Appearance"
TQButtonGroup *bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("&Appearance"), frGeneral );
lo->addWidget( bgStartup );
// show full path in title
config->setGroup("General");
cb_fullPath = new TQCheckBox( i18n("&Show full path in title"), bgStartup);
cb_fullPath->setChecked( mainWindow->viewManager()->getShowFullPath() );
TQWhatsThis::add(cb_fullPath,i18n("If this option is checked, the full document path will be shown in the window caption."));
connect( cb_fullPath, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );
// sort filelist if desired
cb_sortFiles = new TQCheckBox(bgStartup);
cb_sortFiles->setText(i18n("Sort &files alphabetically in the file list"));
cb_sortFiles->setChecked(parent->filelist->sortType() == KateFileList::sortByName);
TQWhatsThis::add( cb_sortFiles, i18n(
"If this is checked, the files in the file list will be sorted alphabetically.") );
connect( cb_sortFiles, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );
// GROUP with the one below: "Behavior"
bgStartup = new TQButtonGroup( 1, Qt::Horizontal, i18n("&Behavior"), frGeneral );
lo->addWidget( bgStartup );
// number of recent files
TQHBox *hbNrf = new TQHBox( bgStartup );
TQLabel *lNrf = new TQLabel( i18n("&Number of recent files:"), hbNrf );
sb_numRecentFiles = new TQSpinBox( 0, 1000, 1, hbNrf );
sb_numRecentFiles->setValue( mainWindow->fileOpenRecent->maxItems() );
lNrf->setBuddy( sb_numRecentFiles );
TQString numRecentFileHelpString ( i18n(
"<qt>Sets the number of recent files remembered by Kate.<p><strong>NOTE: </strong>"
"If you set this lower than the current value, the list will be truncated and "
"some items forgotten.</qt>") );
TQWhatsThis::add( lNrf, numRecentFileHelpString );
TQWhatsThis::add( sb_numRecentFiles, numRecentFileHelpString );
connect( sb_numRecentFiles, TQT_SIGNAL( valueChanged ( int ) ), this, TQT_SLOT( slotChanged() ) );
// Use only one instance of kate (MDI) ?
cb_useInstance = new TQCheckBox(bgStartup);
cb_useInstance->setText(i18n("Always use the current instance of kate to open new files"));
cb_useInstance->setChecked(parent->useInstance);
TQWhatsThis::add( cb_useInstance, i18n(
"When checked, all files opened from outside of Kate will only use the "
"currently opened instance of Kate.") );
connect( cb_useInstance, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );
// sync the konsole ?
cb_syncKonsole = new TQCheckBox(bgStartup);
cb_syncKonsole->setText(i18n("Sync &terminal emulator with active document"));
cb_syncKonsole->setChecked(parent->syncKonsole);
TQWhatsThis::add( cb_syncKonsole, i18n(
"If this is checked, the built in Konsole will <code>cd</code> to the directory "
"of the active document when started and whenever the active document changes, "
"if the document is a local file.") );
connect( cb_syncKonsole, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( slotChanged() ) );
// modified files notification
cb_modNotifications = new TQCheckBox(
i18n("Wa&rn about files modified by foreign processes"), bgStartup );
//.........这里部分代码省略.........
示例11: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
ui2(new Ui::Dialog),
m_aboutDialog(nullptr),
m_baiduTranslater(new CBaiduTranslater(this)),
m_from("auto"),
m_to("auto"),
m_statusInfo(new QLabel(this)),
m_pinWindow(new QToolButton(this)),
//m_updateStyle(new QToolButton(this)),
m_about(new QToolButton(this))
{
ui->setupUi(this);
/* Stay on top tool button */
// m_pinWindow = new QToolButton(this);
m_pinWindow->setObjectName(tr("pinWindow"));
m_pinWindow->setText("置顶");
m_pinWindow->setToolTip(tr("stay on top"));
m_pinWindow->setToolButtonStyle(Qt::ToolButtonTextOnly);
ui->statusBar->addWidget(m_pinWindow, 0);
connect(m_pinWindow, &QToolButton::clicked, this, &MainWindow::togglePinWindow);
/* Update style tool button */
// m_updateStyle = new QToolButton(this);
//m_updateStyle->setObjectName(tr("updateStyle"));
//m_updateStyle->setToolTip(tr("update style"));
//ui->statusBar->addWidget(m_updateStyle, 0);
//connect(m_updateStyle, &QToolButton::clicked, this, &MainWindow::updateStyle);
/* status display label */
// m_statusInfo = new QLabel(this);
m_statusInfo->setAlignment(Qt::AlignRight);
ui->statusBar->addWidget(m_statusInfo, 1);
/* About button */
// m_about = new QToolButton(this);
m_about->setObjectName(tr("about"));
m_about->setToolTip(tr("关于 LBTrans"));
m_about->setText("关于 LBTrans");
m_about->setToolButtonStyle(Qt::ToolButtonTextOnly);
ui->statusBar->insertWidget(2, m_about);
connect(m_about, &QToolButton::clicked, this, &MainWindow::showAboutDialog);
/* initialize translation direction */
initComboBox(ui->comboBox, 0);
initComboBox(ui->comboBoxObject, 1);
// Set baidu translate seveice API key
m_baiduTranslater->setAPI_Key("YaGqITH4r1i95Xp8izAhrxwT");
/* translate */
connect(ui->btnTranslate, SIGNAL(clicked()), this, SLOT(translate()));
connect(m_baiduTranslater, &CBaiduTranslater::finished, this, &MainWindow::showResult);
/* initialize waiting label */
ui->label_statusPicture->setFileName(":/res/loading.gif");
ui->label_statusPicture->hide();
ui->label_translationStatus->setText(tr("正在翻译..."));
ui->label_translationStatus->hide();
/* Set MainWindow title */
setWindowTitle(tr("LBTrans"));
setWindowIcon(QIcon(":/res/windowIcon.ico"));
/* Show in screen center */
QSize screenSize = qApp->desktop()->availableGeometry().size();
QSize mainWindowSize = size();
QPoint destPos;
destPos.setX((screenSize.width() - mainWindowSize.width()) / 2);
destPos.setY((screenSize.height() - mainWindowSize.height()) / 2);
this->move(destPos);
/* contriant window size */
setMaximumSize(size());
setMinimumSize(size());
}
示例12: GLView
InputPreview::InputPreview(QWidget* _parent) :
GLView(_parent)
{
setMinimumSize(128 / devicePixelRatio(),128 / devicePixelRatio());
}
示例13: QDial
QgsDial::QgsDial( QWidget *parent ) : QDial( parent )
{
setMinimumSize( QSize( 50, 50 ) );
}
示例14: QWidget
SwapObjectsIdsWidget::SwapObjectsIdsWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f)
{
try
{
QGridLayout *swap_objs_grid=new QGridLayout(this);
vector<ObjectType> types=BaseObject::getObjectTypes(true, {OBJ_PERMISSION, OBJ_ROLE, OBJ_TEXTBOX,
OBJ_COLUMN, OBJ_CONSTRAINT });
setupUi(this);
PgModelerUiNS::configureWidgetFont(message_lbl, PgModelerUiNS::MEDIUM_FONT_FACTOR);
src_object_sel=nullptr;
dst_object_sel=nullptr;
src_object_sel=new ObjectSelectorWidget(types, true, this);
src_object_sel->enableObjectCreation(false);
dst_object_sel=new ObjectSelectorWidget(types, true, this);
dst_object_sel->enableObjectCreation(false);
swap_objs_grid->setContentsMargins(4,4,4,4);
swap_objs_grid->setSpacing(6);
swap_objs_grid->addWidget(create_lbl, 0, 0);
swap_objs_grid->addWidget(src_object_sel, 0, 1);
swap_objs_grid->addWidget(src_id_lbl, 0, 2);
swap_objs_grid->addWidget(src_ico_lbl, 0, 3);
swap_objs_grid->addWidget(before_lbl, 1, 0);
swap_objs_grid->addWidget(dst_object_sel, 1, 1);
swap_objs_grid->addWidget(dst_id_lbl, 1, 2);
swap_objs_grid->addWidget(dst_ico_lbl, 1, 3);
QHBoxLayout *hlayout=new QHBoxLayout;
hlayout->addSpacerItem(new QSpacerItem(10,10, QSizePolicy::Expanding));
hlayout->addWidget(swap_values_tb);
hlayout->addSpacerItem(new QSpacerItem(10,10, QSizePolicy::Expanding));
swap_objs_grid->addLayout(hlayout, 2, 0, 1, 4);
swap_objs_grid->addItem(new QSpacerItem(10,0,QSizePolicy::Minimum,QSizePolicy::Expanding), swap_objs_grid->count()+1, 0);
swap_objs_grid->addWidget(alert_frm, swap_objs_grid->count()+1, 0, 1, 4);
setModel(nullptr);
connect(src_object_sel, SIGNAL(s_objectSelected(void)), this, SLOT(showObjectId(void)));
connect(dst_object_sel, SIGNAL(s_objectSelected(void)), this, SLOT(showObjectId(void)));
connect(src_object_sel, SIGNAL(s_selectorCleared(void)), this, SLOT(showObjectId(void)));
connect(dst_object_sel, SIGNAL(s_selectorCleared(void)), this, SLOT(showObjectId(void)));
connect(swap_values_tb, &QToolButton::clicked,
[=](){ BaseObject *obj=src_object_sel->getSelectedObject();
src_object_sel->setSelectedObject(dst_object_sel->getSelectedObject());
dst_object_sel->setSelectedObject(obj); });
setMinimumSize(550,150);
}
catch(Exception &e)
{
throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e);
}
}
示例15: window
/*
Initializes histogram representation
span : the period of time to be taken into account
width, height : dimensions
*/
Histogram::Histogram(const QWidget* new_window, unsigned short span, const QColor& new_color, unsigned short width, unsigned short height) : window(new_window), painter(NULL), data(span, 0.0), max(0.0), min(0.0), color(new_color), col_border(QColor(Qt::grey)), col_background(QColor(Qt::black)), timer(0)
{
setSizePolicy(QtGui::QSizePolicy(QtGui::QSizePolicy::Fixed, QtGui::QSizePolicy::Fixed));
setMinimumSize(width, height);
}