本文整理汇总了C++中QScrollView::setResizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollView::setResizePolicy方法的具体用法?C++ QScrollView::setResizePolicy怎么用?C++ QScrollView::setResizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollView
的用法示例。
在下文中一共展示了QScrollView::setResizePolicy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showDialog
bool DateEntryEditor::showDialog( QString caption, OPimEvent& event ) {
QDialog newDlg( m_parent, 0, TRUE );
newDlg.setCaption( caption );
QVBoxLayout *vb = new QVBoxLayout( &newDlg );
QScrollView *sv = new QScrollView( &newDlg );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
sv->setHScrollBarMode( QScrollView::AlwaysOff );
vb->addWidget( sv );
DateEntry *de = new DateEntry( weekStartOnMonday(), isAP(), &newDlg );
de->comboLocation->clear();
de->comboLocation->insertItem("");
de->comboLocation->insertStringList( locations().names() );
de->comboDescription->clear();
de->comboDescription->insertItem("");
de->comboDescription->insertStringList( descriptions().names() );
de->setEvent( event );
sv->addChild( de );
while ( QPEApplication::execDialog( &newDlg ) ) {
de->getEvent( event );
QString error = checkEvent( event );
if ( !error.isNull() ) {
if ( QMessageBox::warning( m_parent, QObject::tr("Error!"), error, QObject::tr("Fix it"), QObject::tr("Continue"), 0, 0, 1 ) == 0 )
continue;
}
return true;
}
return false;
}
示例2: Super
ParameterDialog::ParameterDialog(Miro::CFG::Type const& _parameterType,
QDomNode const& _parentNode,
QDomNode const& _node,
ItemXML * _parentItem,
ItemXML * _item,
QWidget * _parent, const char * _name) :
Super(_parentNode, _node, _parentItem, _item, _parent, _name),
config_(ConfigFile::instance()),
parameterType_(_parameterType),
params_(config_->description().getFullParameterSet(parameterType_))
{
MIRO_ASSERT(!_node.isNull());
initDialog();
QSize s = frame_->sizeHint();
if (s.width() > 800 ||
s.height() > 600) {
delete frame_;
QScrollView * sv = new QScrollView(groupBox_, "scrollview");
frame_ = new QFrame(sv->viewport());
sv->addChild(frame_);
sv->setResizePolicy(QScrollView::AutoOneFit);
initDialog();
frame_->sizeHint();
}
groupBox_->sizeHint(); // we seem to need this to get the right size (hutz)
groupBox_->setTitle("Parameters");
}
示例3: addButtonClicked
void AdminUsers::addButtonClicked()
{
#if DEBUG_ADMINUSERS
qDebug("init addButtonClicked");
#endif
QScrollView *scroll = new QScrollView(this, 0, Qt::WDestructiveClose);
scroll->setResizePolicy(QScrollView::AutoOneFit);
scroll->setMargin(10);
FormAdminUsers *formAdminUsers = new FormAdminUsers(FormBase::Add, scroll->viewport() );
connect(formAdminUsers, SIGNAL(message2osd(const QString& )) , this, SIGNAL(message2osd(const QString& )));
formAdminUsers->setType( FormBase::Add);
connect(formAdminUsers, SIGNAL(cancelled()), scroll, SLOT(close()));
connect(formAdminUsers, SIGNAL(inserted(const QString& )), this, SLOT(addItem( const QString& )));
scroll->addChild(formAdminUsers);
formAdminUsers->setupButtons( FormBase::AcceptButton, FormBase::CancelButton );
formAdminUsers->setTitle(i18n("Admin User"));
formAdminUsers->setExplanation(i18n("Fill the fields with the user information"));
emit sendWidget(scroll,i18n("Add user"));
#if DEBUG_ADMINUSERS
qDebug("end addButtonClicked");
#endif
}
示例4: KAbstractDebugDialog
KListDebugDialog::KListDebugDialog(QStringList areaList, QWidget *parent, const char *name, bool modal)
: KAbstractDebugDialog(parent, name, modal), m_areaList(areaList)
{
setCaption(i18n("Debug Settings"));
QVBoxLayout *lay = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
m_incrSearch = new KLineEdit(this);
lay->addWidget(m_incrSearch);
connect(m_incrSearch, SIGNAL(textChanged(const QString &)), SLOT(generateCheckBoxes(const QString &)));
QScrollView *scrollView = new QScrollView(this);
scrollView->setResizePolicy(QScrollView::AutoOneFit);
lay->addWidget(scrollView);
m_box = new QVBox(scrollView->viewport());
scrollView->addChild(m_box);
generateCheckBoxes(QString::null);
QHBoxLayout *selectButs = new QHBoxLayout(lay);
QPushButton *all = new QPushButton(i18n("&Select All"), this);
QPushButton *none = new QPushButton(i18n("&Deselect All"), this);
selectButs->addWidget(all);
selectButs->addWidget(none);
connect(all, SIGNAL(clicked()), this, SLOT(selectAll()));
connect(none, SIGNAL(clicked()), this, SLOT(deSelectAll()));
buildButtons(lay);
resize(350, 400);
}
示例5: modifyButtonClicked
void AdminUsers::modifyButtonClicked()
{
#if DEBUG_ADMINUSERS
qDebug("init modifyButtonClicked");
#endif
QScrollView *scroll = new QScrollView(this, 0, Qt::WDestructiveClose);
scroll->setResizePolicy(QScrollView::AutoOneFit);
scroll->setMargin(10);
FormAdminUsers *formAdminUsers = new FormAdminUsers(FormBase::Edit, scroll->viewport() );
connect(formAdminUsers, SIGNAL(message2osd(const QString& )) , this, SIGNAL(message2osd(const QString& )));
KLSelect sqlquery(QStringList() << "ldt_users.docident" << "login" << "firstname" << "lastname" << "genre" << "address" << "phone" << "email" << "permissions", QStringList() << "ldt_users" << "ldt_persons" );
sqlquery.setWhere("ldt_persons.docIdent=ldt_users.docIdent and login="+SQLSTR(m_listView->currentItem()->text(2))); // Login in the listview
KLResultSet resultSet = KLDM->execQuery(&sqlquery);
m_xmlsource.setData(resultSet.toString());
if ( ! m_xmlreader.analizeXml(&m_xmlsource, KLResultSetInterpreter::Total) )
{
std::cerr << "No se puede analizar" << std::endl;
return;
}
KLSqlResults results = m_xmlreader.results();
std::cout << results["login"] << std::endl;
formAdminUsers->setAddress( results["address"] );
formAdminUsers->setEmail(results["email"]);
formAdminUsers->setFirstName( results["firstname"]);
formAdminUsers->setIdentification( results["ldt_users.docident"]);
formAdminUsers->setLastName( results["lastname"]);
formAdminUsers->setLogin( results["login"]);
formAdminUsers->setPermissions( results["permissions"]);
formAdminUsers->setPhone( results["phone"]);
formAdminUsers->setGenre( results["genre"]);
formAdminUsers->setType( FormBase::Edit );
connect(formAdminUsers, SIGNAL(cancelled()), scroll, SLOT(close()));
connect(formAdminUsers, SIGNAL(inserted(const QString& )), this, SLOT(updateItem(const QString &)));
scroll->addChild(formAdminUsers);
formAdminUsers->setupButtons( FormBase::AcceptButton, FormBase::CancelButton );
formAdminUsers->setTextAcceptButton(i18n("Modify"));
formAdminUsers->setTextCancelButton(i18n("Close"));
formAdminUsers->setTitle(i18n("Admin User"));
formAdminUsers->setExplanation(i18n("Modify the fields with the user information"));
emit sendWidget(scroll,i18n("Modify user"));
#if DEBUG_ADMINUSERS
qDebug("end addButtonClicked");
#endif
}
示例6: addButtonClicked
void GamesList::addButtonClicked()
{
cout << "Add button clicked" << std::endl;
KMdiChildView *view = new KMdiChildView(i18n("Add game"), this );
( new QVBoxLayout( view ) )->setAutoAdd( true );
QScrollView *scroll = new QScrollView(view);
scroll->setResizePolicy(QScrollView::AutoOneFit);
FormAdminGame *formAdminGame = new FormAdminGame( scroll->viewport() );
scroll->addChild(formAdminGame);
formAdminGame->setupButtons( FormBase::AcceptButton, FormBase::CancelButton );
formAdminGame->setTitle(i18n("Admin game"));
formAdminGame->setExplanation(i18n("fill the fields for add a new game"));
emit sendWidget(view);
}
示例7: QScrollView
ZLDialogContent &ZLQtOptionsDialog::createTab(const ZLResourceKey &key) {
QScrollView *sv = new QScrollView(myTabWidget);
sv->setResizePolicy(QScrollView::AutoOneFit);
sv->setFrameStyle(QFrame::NoFrame);
ZLQtDialogContent *tab = new ZLQtDialogContent(sv->viewport(), tabResource(key));
sv->addChild(tab->widget());
myMenu->insertItem(::qtString(tab->displayName()), -1, myTabs.size());
myTabWidget->addWidget(sv, myTabs.size());
myTabs.push_back(tab);
if(myTabs.size() == 1) {
raiseTab(0);
}
return *tab;
}
示例8: createPage
void XineConfig::createPage(const QString& cat, bool expert, QWidget* parent)
{
xine_cfg_entry_t* ent;
QScrollView* sv = new QScrollView(parent);
sv->setResizePolicy(QScrollView::AutoOneFit);
parent = new QWidget(sv->viewport());
sv->addChild(parent);
QGridLayout* grid = new QGridLayout(parent, 20 ,2);
grid->setColStretch(1,8);
grid->setSpacing(10);
grid->setMargin(10);
uint row = 0;
QString entCat;
/*********** read in xine config entries ***********/
ent = new xine_cfg_entry_t;
xine_config_get_first_entry(m_xine, ent);
do
{
entCat = QString(ent->key);
entCat = entCat.left(entCat.find("."));
if (entCat == cat)
{
if (((!expert) && (QString(NON_EXPERT_OPTIONS).contains(ent->key))) ||
((expert) && (!QString(NON_EXPERT_OPTIONS).contains(ent->key))))
{
m_entries.append(new XineConfigEntry(parent, grid, row, ent));
delete ent;
ent = new xine_cfg_entry_t;
row += 2;
}
}
}
while(xine_config_get_next_entry(m_xine, ent));
delete ent;
}
示例9: if
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);
//.........这里部分代码省略.........
示例10: pageName
HelixConfigDialogBase::HelixConfigDialogBase( HelixEngine *engine, amaroK::PluginConfig *config, QWidget *p )
: QTabWidget( p )
, m_core(0)
, m_plugin(0)
, m_codec(0)
, m_device(0)
, m_engine( engine )
{
int row = 0;
QString currentPage;
QWidget *parent = 0;
QGridLayout *grid = 0;
QScrollView *sv = 0;
QString pageName( i18n("Main") );
addTab( sv = new QScrollView, pageName );
parent = new QWidget( sv->viewport() );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setHScrollBarMode( QScrollView::AlwaysOff );
sv->setFrameShape( QFrame::NoFrame );
sv->addChild( parent );
grid = new QGridLayout( parent, /*rows*/20, /*cols*/2, /*margin*/10, /*spacing*/10 );
grid->setColStretch( 0, 1 );
grid->setColStretch( 1, 1 );
if( sv )
sv->setMinimumWidth( grid->sizeHint().width() + 20 );
engine->m_coredir = HelixConfig::coreDirectory();
m_core = new HelixConfigEntry( parent, engine->m_coredir,
config, row,
i18n("Helix/Realplay core directory"),
HelixConfig::coreDirectory().utf8(),
i18n("This is the directory where clntcore.so is located"));
++row;
engine->m_pluginsdir = HelixConfig::pluginDirectory();
m_plugin = new HelixConfigEntry( parent, engine->m_pluginsdir,
config, row,
i18n("Helix/Realplay plugins directory"),
HelixConfig::pluginDirectory().utf8(),
i18n("This is the directory where, for example, vorbisrend.so is located"));
++row;
engine->m_codecsdir = HelixConfig::codecsDirectory();
m_codec = new HelixConfigEntry( parent, engine->m_codecsdir,
config, row,
i18n("Helix/Realplay codecs directory"),
HelixConfig::codecsDirectory().utf8(),
i18n("This is the directory where, for example, cvt1.so is located"));
++row;
grid->addMultiCellWidget( new KSeparator( KSeparator::Horizontal, parent ), row, row, 0, 1 );
++row;
m_device = new HelixSoundDevice( parent, config, row, engine );
// lets find the logo if we can
QPixmap *pm = 0;
QString logo = HelixConfig::coreDirectory();
if (logo.isEmpty())
logo = HELIX_LIBS "/common";
logo.append("/../share/");
QString tmp = logo;
tmp.append("hxplay/logo.png");
if (QFileInfo(tmp).exists())
{
logo = tmp;
pm = new QPixmap(logo);
}
else
{
tmp = logo;
tmp.append("realplay/logo.png");
if (QFileInfo(tmp).exists())
{
logo = tmp;
pm = new QPixmap(logo);
}
}
if (pm)
{
QLabel *l = new QLabel(parent);
l->setPixmap(*pm);
grid->addMultiCellWidget( l, 20, 20, 1, 1, Qt::AlignRight );
}
entries.setAutoDelete( true );
pageName = i18n("Plugins");
addTab( sv = new QScrollView, pageName );
parent = new QWidget( sv->viewport() );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->addChild( parent );
//.........这里部分代码省略.........
示例11: toggle
Expert::Expert( QWidget *parent ) : QTabDialog( parent )
{
m_dependencies = new QDict< QList<IInput> >(257);
m_dependencies->setAutoDelete(TRUE);
m_inputWidgets = new QDict< IInput >;
m_switches = new QDict< QObject >;
m_changed = FALSE;
setHelpButton();
QListIterator<ConfigOption> options = Config::instance()->iterator();
QVBoxLayout *pageLayout = 0;
QFrame *page = 0;
ConfigOption *option = 0;
for (options.toFirst();(option=options.current());++options)
{
switch(option->kind())
{
case ConfigOption::O_Info:
{
if (pageLayout) pageLayout->addStretch(1);
QScrollView *view = new QScrollView(this);
view->setVScrollBarMode(QScrollView::Auto);
view->setHScrollBarMode(QScrollView::AlwaysOff);
view->setResizePolicy(QScrollView::AutoOneFit);
page = new QFrame( view->viewport(), option->name() );
pageLayout = new QVBoxLayout(page);
pageLayout->setMargin(10);
view->addChild(page);
addTab(view,option->name());
QWhatsThis::add(page, option->docs().simplifyWhiteSpace() );
QToolTip::add(page, option->docs() );
}
break;
case ConfigOption::O_String:
{
ASSERT(page!=0);
InputString::StringMode sm=InputString::StringFree;
switch(((ConfigString *)option)->widgetType())
{
case ConfigString::String: sm=InputString::StringFree; break;
case ConfigString::File: sm=InputString::StringFile; break;
case ConfigString::Dir: sm=InputString::StringDir; break;
}
InputString *inputString = new InputString(
option->name(), // name
page, // widget
*((ConfigString *)option)->valueRef(), // variable
sm // type
);
pageLayout->addWidget(inputString);
QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
QToolTip::add(inputString,option->docs());
connect(inputString,SIGNAL(changed()),SLOT(changed()));
m_inputWidgets->insert(option->name(),inputString);
addDependency(m_switches,option->dependsOn(),option->name());
}
break;
case ConfigOption::O_Enum:
{
ASSERT(page!=0);
InputString *inputString = new InputString(
option->name(), // name
page, // widget
*((ConfigEnum *)option)->valueRef(), // variable
InputString::StringFixed // type
);
pageLayout->addWidget(inputString);
QStrListIterator sli=((ConfigEnum *)option)->iterator();
for (sli.toFirst();sli.current();++sli)
{
inputString->addValue(sli.current());
}
inputString->init();
QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
QToolTip::add(inputString, option->docs());
connect(inputString,SIGNAL(changed()),SLOT(changed()));
m_inputWidgets->insert(option->name(),inputString);
addDependency(m_switches,option->dependsOn(),option->name());
}
break;
case ConfigOption::O_List:
{
ASSERT(page!=0);
InputStrList::ListMode lm=InputStrList::ListString;
switch(((ConfigList *)option)->widgetType())
{
case ConfigList::String: lm=InputStrList::ListString; break;
case ConfigList::File: lm=InputStrList::ListFile; break;
case ConfigList::Dir: lm=InputStrList::ListDir; break;
case ConfigList::FileAndDir: lm=InputStrList::ListFileDir; break;
}
InputStrList *inputStrList = new InputStrList(
option->name(), // name
page, // widget
*((ConfigList *)option)->valueRef(), // variable
lm // type
);
pageLayout->addWidget(inputStrList);
//.........这里部分代码省略.........
示例12: QDialog
FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
const QString &server, const QString &destination,
OPackageManager::Status status, const QString &category )
: QDialog( parent, QString::null, true, WStyle_ContextHelp )
{
setCaption( tr( "Filter packages" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
layout->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
layout = new QVBoxLayout( container, 4, 4 );
// Category
m_categoryCB = new QCheckBox( tr( "Category:" ), container );
QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) );
connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) );
m_category = new QComboBox( container );
QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) );
m_category->insertStringList( pm->categories() );
initItem( m_category, m_categoryCB, category );
layout->addWidget( m_categoryCB );
layout->addWidget( m_category );
// Package name
m_nameCB = new QCheckBox( tr( "Names containing:" ), container );
QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) );
connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) );
m_name = new QLineEdit( name, container );
QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) );
if ( !name.isNull() )
m_nameCB->setChecked( true );
m_name->setEnabled( !name.isNull() );
layout->addWidget( m_nameCB );
layout->addWidget( m_name );
// Status
m_statusCB = new QCheckBox( tr( "With the status:" ), container );
QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) );
connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) );
m_status = new QComboBox( container );
QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) );
connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) );
QString currStatus;
switch ( status )
{
case OPackageManager::All : currStatus = tr( "All" );
break;
case OPackageManager::Installed : currStatus = tr( "Installed" );
break;
case OPackageManager::NotInstalled : currStatus = tr( "Not installed" );
break;
case OPackageManager::Updated : currStatus = tr( "Updated" );
break;
default : currStatus = QString::null;
};
m_status->insertItem( tr( "All" ) );
m_status->insertItem( tr( "Installed" ) );
m_status->insertItem( tr( "Not installed" ) );
m_status->insertItem( tr( "Updated" ) );
initItem( m_status, m_statusCB, currStatus );
layout->addWidget( m_statusCB );
layout->addWidget( m_status );
// Server
m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) );
connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
m_server = new QComboBox( container );
QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) );
m_server->insertStringList( pm->servers() );
initItem( m_server, m_serverCB, server );
layout->addWidget( m_serverCB );
layout->addWidget( m_server );
// Destination
m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) );
connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
m_destination = new QComboBox( container );
QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) );
m_destination->insertStringList( pm->destinations() );
initItem( m_destination, m_destCB, destination );
layout->addWidget( m_destCB );
layout->addWidget( m_destination );
}
示例13: KDialogBase
Kleo::KeyApprovalDialog::KeyApprovalDialog( const std::vector<Item> & recipients,
const std::vector<GpgME::Key> & sender,
QWidget * parent, const char * name,
bool modal )
: KDialogBase( parent, name, modal, i18n("Encryption Key Approval"), Ok|Cancel, Ok ),
d( 0 )
{
assert( !recipients.empty() );
d = new Private();
QFrame *page = makeMainWidget();
QVBoxLayout * vlay = new QVBoxLayout( page, 0, spacingHint() );
vlay->addWidget( new QLabel( i18n("The following keys will be used for encryption:"), page ) );
QScrollView * sv = new QScrollView( page );
sv->setResizePolicy( QScrollView::AutoOneFit );
vlay->addWidget( sv );
QWidget * view = new QWidget( sv->viewport() );
QGridLayout * glay = new QGridLayout( view, 3, 2, marginHint(), spacingHint() );
glay->setColStretch( 1, 1 );
sv->addChild( view );
int row = -1;
if ( !sender.empty() ) {
++row;
glay->addWidget( new QLabel( i18n("Your keys:"), view ), row, 0 );
d->selfRequester = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view );
d->selfRequester->setKeys( sender );
glay->addWidget( d->selfRequester, row, 1 );
++row;
glay->addMultiCellWidget( new KSeparator( Horizontal, view ), row, row, 0, 1 );
}
const QStringList prefs = preferencesStrings();
for ( std::vector<Item>::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it ) {
++row;
glay->addWidget( new QLabel( i18n("Recipient:"), view ), row, 0 );
glay->addWidget( new QLabel( it->address, view ), row, 1 );
d->addresses.push_back( it->address );
++row;
glay->addWidget( new QLabel( i18n("Encryption keys:"), view ), row, 0 );
KeyRequester * req = new EncryptionKeyRequester( true, EncryptionKeyRequester::AllProtocols, view );
req->setKeys( it->keys );
glay->addWidget( req, row, 1 );
d->requesters.push_back( req );
++row;
glay->addWidget( new QLabel( i18n("Encryption preference:"), view ), row, 0 );
QComboBox * cb = new QComboBox( false, view );
cb->insertStringList( prefs );
glay->addWidget( cb, row, 1 );
cb->setCurrentItem( pref2cb( it->pref ) );
connect( cb, SIGNAL(activated(int)), SLOT(slotPrefsChanged()) );
d->preferences.push_back( cb );
}
// calculate the optimal width for the dialog
const int dialogWidth = marginHint()
+ sv->frameWidth()
+ view->sizeHint().width()
+ sv->verticalScrollBar()->sizeHint().width()
+ sv->frameWidth()
+ marginHint()
+ 2;
// calculate the optimal height for the dialog
const int dialogHeight = marginHint()
+ fontMetrics().height()
+ spacingHint()
+ sv->frameWidth()
+ view->sizeHint().height()
+ sv->horizontalScrollBar()->sizeHint().height()
+ sv->frameWidth()
+ spacingHint()
+ actionButton( KDialogBase::Cancel )->sizeHint().height()
+ marginHint()
+ 2;
// don't make the dialog too large
const QRect desk = KGlobalSettings::desktopGeometry( this );
setInitialSize( QSize( kMin( dialogWidth, 3 * desk.width() / 4 ),
kMin( dialogHeight, 7 * desk.height() / 8 ) ) );
}
示例14: if
void
WaveMaker::createGUI(DefaultGUIModel::variable_t *var, int size)
{
QBoxLayout *layout = new QHBoxLayout(this); // overall GUI layout
// Left side GUI
QBoxLayout *leftlayout = new QVBoxLayout();
QHButtonGroup *fileBox = new QHButtonGroup("File:", this);
QPushButton *loadBttn = new QPushButton("Load File", fileBox);
QPushButton *previewBttn = new QPushButton("Preview File", fileBox);
QObject::connect(loadBttn, SIGNAL(clicked()), this, SLOT(loadFile()));
QObject::connect(previewBttn, SIGNAL(clicked()), this, SLOT(previewFile()));
QHBox *utilityBox = new QHBox(this);
pauseButton = new QPushButton("Pause", utilityBox);
pauseButton->setToggleButton(true);
QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
QObject::connect(pauseButton, SIGNAL(toggled(bool)), loadBttn, SLOT(setEnabled(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)));
QObject::connect(pauseButton, SIGNAL(toggled(bool)), modifyButton, SLOT(setEnabled(bool)));
QToolTip::add(pauseButton, "Start/Stop Plug-in");
QToolTip::add(modifyButton, "Commit Changes to Parameter Values");
QToolTip::add(unloadButton, "Close Plug-in");
// Add custom left side GUI components to layout above default_gui_model components
leftlayout->addWidget(fileBox);
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);
param.type = EVENT;
param.index = nevent++;
}
else if (vars[i].flags & COMMENT)
{
param.type = COMMENT;
param.index = ncomment++;
}
parameter[vars[i].name] = param;
}
}
//.........这里部分代码省略.........
示例15: if
// The constructor sets up the GUI, laying out the parameters on the left and
// the two plots on the right. There's nothing special here, it's just long.
// The code for the labels and text boxes for the parameters (on the left) is
// boilerplate ripped directly from default_gui_model, and should really be
// refactored out of here.
Istep::Istep(void) :
QWidget(MainWindow::getInstance()->centralWidget()),
Workspace::Instance("Istep", ::vars, ::num_vars),
period(1.0),
delay(0.0),
Amin(-100.0),
Amax(100.0),
Nsteps(20),
Ncycles(1),
duty(50),
offset(0.0),
factor(200.0),
periodsSincePlot(0)
{
setCaption(QString::number(getID()) + " Istep");
QBoxLayout *layout = new QHBoxLayout(this); // overall GUI layout
QBoxLayout *leftLayout = new QVBoxLayout();
QHBox *utilityBox = new QHBox(this);
pauseButton = new QPushButton("Pause", utilityBox);
pauseButton->setToggleButton(true);
QPushButton *modifyButton = new QPushButton("Modify", utilityBox);
QPushButton *unloadButton = new QPushButton("Unload", utilityBox);
QObject::connect(pauseButton, SIGNAL(toggled(bool)), this, SLOT(pause(bool)));
QObject::connect(modifyButton, SIGNAL(clicked(void)), this, SLOT(modify(void)));
QObject::connect(unloadButton, SIGNAL(clicked(void)), this, SLOT(exit(void)));
QObject::connect(pauseButton, SIGNAL(toggled(bool)), modifyButton, SLOT(setEnabled(bool)));
QToolTip::add(pauseButton, "Start/Stop Istep protocol");
QToolTip::add(modifyButton, "Commit changes to parameter values and reset");
QToolTip::add(unloadButton, "Close plug-in");
// create default_gui_model GUI DO NOT EDIT
QScrollView *sv = new QScrollView(this);
sv->setResizePolicy(QScrollView::AutoOneFit);
sv->setHScrollBarMode(QScrollView::AlwaysOff);
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 = {0};
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.type = STATE;
param.index = nstate++;
}
else if (vars[i].flags & EVENT)
{
param.edit->setReadOnly(true);
param.type = EVENT;
param.index = nevent++;
}
else if (vars[i].flags & COMMENT)
{
//.........这里部分代码省略.........