本文整理汇总了C++中QScrollView::viewport方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollView::viewport方法的具体用法?C++ QScrollView::viewport怎么用?C++ QScrollView::viewport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollView
的用法示例。
在下文中一共展示了QScrollView::viewport方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: 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);
}
示例3: 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");
}
示例4: 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
}
示例5: actualWidget
QWidget* KCursorPrivateAutoHideEventFilter::actualWidget() const
{
QWidget* w = m_widget;
// Is w a scrollview ? Call setCursor on the viewport in that case.
QScrollView * sv = dynamic_cast<QScrollView *>( w );
if ( sv )
w = sv->viewport();
return w;
}
示例6: QMainWindow
ReportWindow::ReportWindow(ReportGridOptions * rgo, QWidget * parent, const char * name)
: QMainWindow(parent, name, WDestructiveClose) {
lastSaveToDb = FALSE;
dbRecordGrade = -1;
_modified = FALSE;
_handler = 0;
setCaption();
setIcon(QPixmap(document_xpm));
qsList = new QuerySourceList();
pageOptions = new ReportPageOptions();
gridOptions = rgo;
rptHead = rptFoot = 0;
pageHeadFirst = pageHeadOdd = pageHeadEven = pageHeadLast = pageHeadAny = 0;
pageFootFirst = pageFootOdd = pageFootEven = pageFootLast = pageFootAny = 0;
// Set default Watermark Properties
_wmOpacity = 25;
_wmFont = QFont("Arial");
_wmUseDefaultFont = true;
_wmUseStaticText = true;
_wmText = QString::null;
_wmColumn = QString::null;
_wmQuery = QString::null;
// Set default Background Properties
_bgEnabled = false;
_bgStatic = true;
_bgImage = QString::null;
_bgQuery = QString::null;
_bgColumn = QString::null;
_bgResizeMode = "clip";
_bgAlign = Qt::AlignLeft | Qt::AlignTop;
_bgBoundsX = 100;
_bgBoundsY = 100;
_bgBoundsWidth = 650;
_bgBoundsHeight = 900;
_bgOpacity = 25;
QScrollView * sv = new QScrollView(this);
vbox = new QWidget(sv->viewport());
vboxlayout = new QVBoxLayout(vbox);
sv->addChild(vbox);
setCentralWidget(sv);
ReportSectionDetail * rsd = new ReportSectionDetail(this,vbox);
insertSection(detailSectionCount(), rsd);
connect(pageOptions, SIGNAL(pageOptionsChanged()), this, SLOT(setModified()));
connect(qsList, SIGNAL(updated()), this, SLOT(setModified()));
}
示例7: 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);
}
示例8: 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;
}
示例9: 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;
}
示例10: 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 ) ) );
}
示例11: 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);
//.........这里部分代码省略.........
示例12: 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 );
//.........这里部分代码省略.........
示例13: QDialog
IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp)
{
setCaption(tr("Settings") );
m_config = new Config("OpieIRC");
m_config->setGroup("OpieIRC");
QHBoxLayout *l = new QHBoxLayout(this, 2, 2);
OTabWidget *tw = new OTabWidget(this);
l->addWidget(tw);
/* General Configuration */
QWidget *genwidget = new QWidget(tw);
QGridLayout *layout = new QGridLayout(genwidget, 1, 4, 5, 0);
QLabel *label = new QLabel(tr("Lines displayed :"), genwidget);
layout->addWidget(label, 0, 0);
m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget);
QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this"));
QIntValidator *validator = new QIntValidator(this);
validator->setTop(10000);
validator->setBottom(0);
m_lines->setValidator(validator);
layout->addWidget(m_lines, 0, 1);
/*
* include timestamp
*/
m_displayTime = new QCheckBox( tr("Display time in chat log"), genwidget );
m_displayTime->setChecked( m_config->readBoolEntry("DisplayTime", false) );
layout->addMultiCellWidget(m_displayTime, 1, 1, 0, 4 );
// add a spacer
layout->addItem( new QSpacerItem(1,1, QSizePolicy::Minimum,
QSizePolicy::MinimumExpanding),
2, 0 );
tw->addTab(genwidget, "opieirc/settings", tr("General"));
/* Color configuration */
QScrollView *view = new QScrollView(this);
view->setResizePolicy(QScrollView::AutoOneFit);
view->setFrameStyle( QFrame::NoFrame );
QWidget *widget = new QWidget(view->viewport());
view->addChild(widget);
layout = new QGridLayout(widget, 7, 2, 5, 0);
label = new QLabel(tr("Background color :"), widget);
layout->addWidget(label, 0, 0);
m_background = new OColorButton(widget, m_config->readEntry("BackgroundColor", "#FFFFFF"));
QWhatsThis::add(m_background, tr("Background color to be used in chats"));
layout->addWidget(m_background, 0, 1);
label = new QLabel(tr("Normal text color :"), widget);
layout->addWidget(label, 1, 0);
m_text = new OColorButton(widget, m_config->readEntry("TextColor", "#000000"));
QWhatsThis::add(m_text, tr("Text color to be used in chats"));
layout->addWidget(m_text, 1, 1);
label = new QLabel(tr("Error color :"), widget);
layout->addWidget(label, 2, 0);
m_error = new OColorButton(widget, m_config->readEntry("ErrorColor", "#FF0000"));
QWhatsThis::add(m_error, tr("Text color to be used to display errors"));
layout->addWidget(m_error, 2, 1);
label = new QLabel(tr("Text written by yourself :"), widget);
layout->addWidget(label, 3, 0);
m_self = new OColorButton(widget, m_config->readEntry("SelfColor", "#CC0000"));
QWhatsThis::add(m_self, tr("Text color to be used to identify text written by yourself"));
layout->addWidget(m_self, 3, 1);
label = new QLabel(tr("Text written by others :"), widget);
layout->addWidget(label, 4, 0);
m_other = new OColorButton(widget, m_config->readEntry("OtherColor", "#0000BB"));
QWhatsThis::add(m_other, tr("Text color to be used to identify text written by others"));
layout->addWidget(m_other, 4, 1);
label = new QLabel(tr("Text written by the server :"), widget);
layout->addWidget(label, 5, 0);
m_server = new OColorButton(widget, m_config->readEntry("ServerColor", "#0000FF"));
QWhatsThis::add(m_server, tr("Text color to be used to identify text written by the server"));
layout->addWidget(m_server, 5, 1);
label = new QLabel(tr("Notifications :"), widget);
layout->addWidget(label, 6, 0);
m_notification = new OColorButton(widget, m_config->readEntry("NotificationColor", "#006400"));
QWhatsThis::add(m_notification, tr("Text color to be used to display notifications"));
layout->addWidget(m_notification, 6, 1);
tw->addTab(view, "opieirc/colors", tr("Colors"));
/*
* IRC EditLine KeyConfiguration
*/
m_keyConf = new Opie::Ui::OKeyConfigWidget(tw, "KEyConfig GUI" );
m_keyConf->setChangeMode( OKeyConfigWidget::Queue );
m_keyConf->insert( tr("Keyboard Shortcuts"),
IRCHistoryLineEdit::keyConfigInstance() );
m_keyConf->load();
tw->addTab(m_keyConf, "SettingsIcon", tr("Keyboard Shortcuts") );
tw->setCurrentTab( genwidget );
QPEApplication::showDialog( this );
}
示例14: QLabel
SequenceNumber::SequenceNumber(MainWindow* main)
: QuasarWindow(main, "SequenceNumber")
{
_helpSource = "seq_number.html";
QFrame* frame = new QFrame(this);
QScrollView* sv = new QScrollView(frame);
_nums = new QButtonGroup(4, Horizontal, tr("Seq Numbers"), sv->viewport());
new QLabel("Type", _nums);
new QLabel("Minimum", _nums);
new QLabel("Maximum", _nums);
new QLabel("Next", _nums);
addIdEdit(tr("Data Object:"), "data_object", "object_id");
addIdEdit(tr("Journal Entry:"), "gltx", "Journal Entry");
addIdEdit(tr("Ledger Transfer:"), "gltx", "Ledger Transfer");
addIdEdit(tr("Card Adjustment:"), "gltx", "Card Adjustment");
addIdEdit(tr("Customer Invoice:"), "gltx", "Customer Invoice");
addIdEdit(tr("Customer Return:"), "gltx", "Customer Return");
addIdEdit(tr("Customer Payment:"), "gltx", "Customer Payment");
addIdEdit(tr("Customer Quote:"), "quote", "number");
addIdEdit(tr("Vendor Invoice:"), "gltx", "Vendor Invoice");
addIdEdit(tr("Vendor Claim:"), "gltx", "Vendor Claim");
addIdEdit(tr("Purchase Order:"), "porder", "number");
addIdEdit(tr("Packing Slip:"), "slip", "number");
addIdEdit(tr("Nosale:"), "gltx", "Nosale");
addIdEdit(tr("Payout:"), "gltx", "Payout");
addIdEdit(tr("Withdraw:"), "gltx", "Withdraw");
addIdEdit(tr("Shift:"), "gltx", "Shift");
addIdEdit(tr("Item Adjustment:"), "gltx", "Item Adjustment");
addIdEdit(tr("Item Transfer:"), "gltx", "Item Transfer");
addIdEdit(tr("Physical Count:"), "pcount", "number");
addIdEdit(tr("Label Batch:"), "label_batch", "number");
addIdEdit(tr("Price Batch:"), "price_batch", "number");
addIdEdit(tr("Promo Batch:"), "promo_batch", "number");
addIdEdit(tr("Company Number:"), "company", "number");
addIdEdit(tr("Store Number:"), "store", "number");
addIdEdit(tr("Station Number:"), "station", "number");
addIdEdit(tr("Tender Count #:"), "tender_count", "number");
addIdEdit(tr("Tender Menu #:"), "tender", "menu_num");
QFrame* buttons = new QFrame(frame);
QPushButton* ok = new QPushButton(tr("&OK"), buttons);
QPushButton* quit = new QPushButton(tr("&Close"), buttons);
connect(ok, SIGNAL(clicked()), SLOT(slotOk()));
connect(quit, SIGNAL(clicked()), SLOT(close()));
QGridLayout* buttonGrid = new QGridLayout(buttons);
buttonGrid->setSpacing(3);
buttonGrid->setMargin(3);
buttonGrid->setColStretch(0, 1);
buttonGrid->addWidget(ok, 0, 1);
buttonGrid->addWidget(quit, 0, 2);
_nums->resize(_nums->sizeHint());
sv->setVScrollBarMode(QScrollView::AlwaysOn);
sv->resizeContents(_nums->width() + 20, _nums->height());
QGridLayout* grid = new QGridLayout(frame);
grid->setSpacing(6);
grid->setMargin(6);
grid->setRowStretch(0, 1);
grid->addWidget(sv, 0, 0);
grid->addWidget(buttons, 1, 0);
for (unsigned int i = 0; i < _ids.size(); ++i) {
IdInfo& info = _ids[i];
_quasar->db()->getSequence(info.seq);
info.minNum->setFixed(info.seq.minNumber());
info.maxNum->setFixed(info.seq.maxNumber());
info.nextNum->setFixed(info.seq.nextNumber());
}
statusBar()->hide();
setCentralWidget(frame);
setCaption(tr("Sequence Numbers"));
finalize();
if (!allowed("View")) {
QTimer::singleShot(50, this, SLOT(slotNotAllowed()));
return;
}
}
示例15: if
void
TDDDriver::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();
//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)));
QPixmap *drawsurface = new QPixmap(640,480);
QWidget *drawplane = new QWidget;
drawplane->resize(640, drawplane->width());
drawsurface->fill(Qt::black);
bitBlt(drawplane,0,0,drawsurface);
printf("Widget Width = %d \n", drawplane->width());
rightlayout->addWidget(drawplane);
// 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);
param.type = EVENT;
param.index = nevent++;
}
else if (vars[i].flags & COMMENT)
{
param.type = COMMENT;
param.index = ncomment++;
}
//.........这里部分代码省略.........