本文整理汇总了C++中QLabel::setAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setAlignment方法的具体用法?C++ QLabel::setAlignment怎么用?C++ QLabel::setAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createGui
void JabberAddAccountWidget::createGui(bool showButtons)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QWidget *formWidget = new QWidget(this);
mainLayout->addWidget(formWidget);
QFormLayout *layout = new QFormLayout(formWidget);
QWidget *jidWidget = new QWidget(this);
QGridLayout *jidLayout = new QGridLayout(jidWidget);
jidLayout->setSpacing(0);
jidLayout->setMargin(0);
jidLayout->setColumnStretch(0, 2);
jidLayout->setColumnStretch(2, 2);
Username = new QLineEdit(this);
connect(Username, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
jidLayout->addWidget(Username);
AtLabel = new QLabel("@", this);
jidLayout->addWidget(AtLabel, 0, 1);
Domain = new QComboBox();
Domain->setEditable(true);
if (!Factory->allowChangeServer())
{
Domain->setVisible(false);
AtLabel->setVisible(false);
QString toolTip = Factory->whatIsMyUsername();
if (!toolTip.isEmpty())
{
QLabel *whatIsMyUsernameLabel = new QLabel(tr("<a href='#'>What is my username?</a>"), this);
whatIsMyUsernameLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
jidLayout->addWidget(whatIsMyUsernameLabel, 0, 2, Qt::AlignRight);
connect(whatIsMyUsernameLabel, SIGNAL(linkActivated(QString)), this, SLOT(showWhatIsMyUsername()));
}
}
else
{
connect(Domain, SIGNAL(currentIndexChanged(QString)), this, SLOT(dataChanged()));
connect(Domain, SIGNAL(editTextChanged(QString)), this, SLOT(dataChanged()));
}
jidLayout->addWidget(Domain, 0, 2);
layout->addRow(tr("Username") + ':', jidWidget);
AccountPassword = new QLineEdit(this);
connect(AccountPassword, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
AccountPassword->setEchoMode(QLineEdit::Password);
layout->addRow(tr("Password") + ':', AccountPassword);
RememberPassword = new QCheckBox(tr("Remember Password"), this);
layout->addRow(0, RememberPassword);
Identity = new IdentitiesComboBox(this);
connect(Identity, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged()));
layout->addRow(tr("Account Identity") + ':', Identity);
QLabel *infoLabel = new QLabel(tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"), this);
infoLabel->setWordWrap(true);
infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
layout->addRow(0, infoLabel);
mainLayout->addStretch(100);
QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this);
mainLayout->addWidget(buttons);
AddAccountButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add Account"), this);
QPushButton *cancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
buttons->addButton(AddAccountButton, QDialogButtonBox::AcceptRole);
buttons->addButton(cancelButton, QDialogButtonBox::DestructiveRole);
connect(AddAccountButton, SIGNAL(clicked(bool)), this, SLOT(apply()));
connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));
if (!showButtons)
buttons->hide();
}
示例2: createRibbon
void MainWindow::createRibbon()
{
if (Qtitan::RibbonPage* pageGallery = ribbonBar()->addPage( tr("&Galleries 1")))
{
if (Qtitan::RibbonGroup* groupPopup = pageGallery->addGroup(tr("Popup Galleries")))
{
groupPopup->setOptionButtonVisible();
QAction* act = groupPopup->optionButtonAction();
act->setToolTip(tr("Popup Galleries"));
connect(act, SIGNAL(triggered()), this, SLOT(pressButton()));
groupPopup->setControlsCentering(true);
OfficePopupMenu* popup = OfficePopupMenu::createPopupMenu(this);
Qtitan::RibbonGallery* popupGallery = new Qtitan::RibbonGallery;
popupGallery->setBaseSize(QSize(307, 168));
popupGallery->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
popupGallery->setGalleryGroup(m_itemsStyles);
popup->addWidget(popupGallery);
popup->addSeparator();
popup->addAction(tr("Save Style"));
popup->addAction(tr("Apply Style"));
groupPopup->addAction(QIcon(":/res/largeStyleButton.png"), tr("Styles"),
Qt::ToolButtonTextUnderIcon, popup, QToolButton::InstantPopup);
popup = OfficePopupMenu::createPopupMenu(this);
m_popupTableGallery = new Qtitan::RibbonGallery;
m_popupTableGallery->setBaseSize(QSize(193, 175));
m_popupTableGallery->setLabelsVisible(true);
m_popupTableGallery->setScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_popupTableGallery->setGalleryGroup(m_itemsTable);
popup->addWidget(m_popupTableGallery);
groupPopup->addAction(QIcon(":/res/largeTable.png"), tr("Table"),
Qt::ToolButtonTextUnderIcon, popup, QToolButton::InstantPopup);
connect(m_popupTableGallery, SIGNAL(itemPressed(RibbonGalleryItem*)),
this, SLOT(itemTablePressed(RibbonGalleryItem*)));
popup = OfficePopupMenu::createPopupMenu(this);
popupGallery = new Qtitan::RibbonGallery();
popupGallery->setBaseSize(QSize(173, 145));
popupGallery->setLabelsVisible(true);
popupGallery->setScrollBarPolicy(Qt::ScrollBarAlwaysOff);
popupGallery->setGalleryGroup(m_itemsFontTextColor);
popup->addWidget(popupGallery);
groupPopup->addAction(QIcon(":/res/largeColorButton.png"),
tr("Color"), Qt::ToolButtonTextUnderIcon, popup, QToolButton::InstantPopup);
popup = OfficePopupMenu::createPopupMenu(this);
popup->setGripVisible(false);
m_popupUndoGallery = new WidgetGalleryUndo();
m_popupUndoGallery->setGalleryGroup(m_itemsUndo);
m_popupUndoGallery->setBaseSize(QSize(120, m_itemsUndo->getSize().height() * m_itemsUndo->getItemCount() + 2));
m_popupUndoGallery->setScrollBarPolicy(Qt::ScrollBarAlwaysOff);
popup->addWidget(m_popupUndoGallery);
QLabel* label = new QLabel();
label->setAlignment(Qt::AlignCenter);
label->setMinimumWidth(118);
popup->addWidget(label);
m_popupUndoGallery->selectedItemChanged();
m_actionUndo = groupPopup->addAction(QIcon(":/res/largeUndo.png"),
tr("Undo"), Qt::ToolButtonTextUnderIcon, popup);
connect(popup, SIGNAL(aboutToHide()), this, SLOT(aboutToHideUndo()));
connect(m_popupUndoGallery, SIGNAL(itemPressed(RibbonGalleryItem*)),
this, SLOT(itemUndoPressed(RibbonGalleryItem*)));
}
if (Qtitan::RibbonGroup* groupInline = pageGallery->addGroup(tr("Inline Galleries")))
{
groupInline->setOptionButtonVisible();
QAction* act = groupInline->optionButtonAction();
act->setToolTip(tr("Inline Galleries"));
connect(act, SIGNAL(triggered()), this, SLOT(pressButton()));
groupInline->setControlsCentering(true);
m_widgetFontTextColor = new Qtitan::RibbonGallery;
m_widgetFontTextColor->setBaseSize(QSize(190, 60));
m_widgetFontTextColor->setLabelsVisible(false);
m_widgetFontTextColor->setScrollBarPolicy(Qt::ScrollBarAlwaysOn);
m_widgetFontTextColor->setBorderVisible(true);
m_widgetFontTextColor->setGalleryGroup(m_itemsFontTextColor);
m_widgetFontTextColor->setCheckedIndex(1);
act = groupInline->addWidget(m_widgetFontTextColor);
act->setText(tr("&Color"));
connect(m_widgetFontTextColor, SIGNAL(itemPressed(RibbonGalleryItem*)),
this, SLOT(itemColorPressed(RibbonGalleryItem*)));
groupInline->addSeparator();
m_widgetStyleFont = new Qtitan::RibbonGallery;
m_widgetStyleFont->setBaseSize(QSize(632, 60));
m_widgetStyleFont->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_widgetStyleFont->setLabelsVisible(false);
m_widgetStyleFont->setContentsMargins(0, 1, 0, 1);
m_widgetStyleFont->setBorderVisible(true);
m_widgetStyleFont->setGalleryGroup(m_itemsStyles);
m_widgetStyleFont->setCheckedIndex(0);
//.........这里部分代码省略.........
示例3: BrowserCategory
PlaylistBrowserNS::DynamicCategory::DynamicCategory( QWidget* parent )
: BrowserCategory( "dynamic category", parent )
{
setPrettyName( i18n( "Dynamic Playlists" ) );
setShortDescription( i18n( "Dynamically updating parameter based playlists" ) );
setIcon( KIcon( "dynamic-amarok" ) );
setLongDescription( i18n( "With a dynamic playlist, Amarok becomes your own personal dj, automatically selecting tracks for you, based on a number of parameters that you select." ) );
setImagePath( KStandardDirs::locate( "data", "amarok/images/hover_info_dynamic_playlists.png" ) );
// set background
if( AmarokConfig::showBrowserBackgroundImage() )
setBackgroundImage( imagePath() );
bool enabled = AmarokConfig::dynamicMode();
setContentsMargins( 0, 0, 0, 0 );
KHBox* controls2Layout = new KHBox( this );
QLabel *label;
label = new QLabel( i18n( "Previous:" ), controls2Layout );
label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
m_previous = new QSpinBox( controls2Layout );
m_previous->setMinimum( 0 );
m_previous->setToolTip( i18n( "Number of previous tracks to remain in the playlist." ) );
m_previous->setValue( AmarokConfig::previousTracks() );
QObject::connect( m_previous, SIGNAL(valueChanged(int)), this, SLOT(setPreviousTracks(int)) );
label = new QLabel( i18n( "Upcoming:" ), controls2Layout );
// label->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
m_upcoming = new QSpinBox( controls2Layout );
m_upcoming->setMinimum( 1 );
m_upcoming->setToolTip( i18n( "Number of upcoming tracks to add to the playlist." ) );
m_upcoming->setValue( AmarokConfig::upcomingTracks() );
QObject::connect( m_upcoming, SIGNAL(valueChanged(int)), this, SLOT(setUpcomingTracks(int)) );
QObject::connect( (const QObject*)Amarok::actionCollection()->action( "playlist_clear" ), SIGNAL(triggered(bool)), this, SLOT(playlistCleared()) );
QObject::connect( (const QObject*)Amarok::actionCollection()->action( "disable_dynamic" ), SIGNAL(triggered(bool)), this, SLOT(playlistCleared()), Qt::DirectConnection );
// -- the tool bar
KHBox* presetLayout = new KHBox( this );
KToolBar* presetToolbar = new KToolBar( presetLayout );
presetToolbar->setIconSize( QSize( 22, 22 ) );
presetToolbar->setToolButtonStyle( Qt::ToolButtonIconOnly );
presetToolbar->setMovable( false );
presetToolbar->setFloatable( false );
presetToolbar->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
m_onOffButton = new QToolButton( presetToolbar );
m_onOffButton->setText( i18nc( "Turn dynamic mode on", "On") );
m_onOffButton->setCheckable( true );
m_onOffButton->setIcon( KIcon( "dynamic-amarok" ) );
m_onOffButton->setToolTip( i18n( "Turn dynamic mode on." ) );
presetToolbar->addWidget( m_onOffButton );
m_duplicateButton = new QToolButton( presetToolbar );
m_duplicateButton->setText( i18n("Duplicates") );
m_duplicateButton->setCheckable( true );
m_duplicateButton->setChecked( allowDuplicates() );
m_duplicateButton->setIcon( KIcon( "edit-copy" ) );
m_duplicateButton->setToolTip( i18n( "Allow duplicate songs in result" ) );
presetToolbar->addWidget( m_duplicateButton );
m_addButton = new QToolButton( presetToolbar );
m_addButton->setText( i18n("New") );
m_addButton->setIcon( KIcon( "document-new" ) );
m_addButton->setToolTip( i18n( "New playlist" ) );
presetToolbar->addWidget( m_addButton );
m_editButton = new QToolButton( presetToolbar );
m_editButton->setText( i18n("Edit") );
m_editButton->setIcon( KIcon( "document-properties-amarok" ) );
m_editButton->setToolTip( i18n( "Edit the selected playlist or bias" ) );
presetToolbar->addWidget( m_editButton );
m_deleteButton = new QToolButton( presetToolbar );
m_deleteButton->setText( i18n("Delete") );
m_deleteButton->setEnabled( false );
m_deleteButton->setIcon( KIcon( "edit-delete" ) );
m_deleteButton->setToolTip( i18n( "Delete the selected playlist or bias") );
presetToolbar->addWidget( m_deleteButton );
m_repopulateButton = new QPushButton( presetLayout );
m_repopulateButton->setText( i18n("Repopulate") );
m_repopulateButton->setToolTip( i18n("Replace the upcoming tracks with fresh ones.") );
m_repopulateButton->setIcon( KIcon( "view-refresh-amarok" ) );
m_repopulateButton->setEnabled( enabled );
// m_repopulateButton->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
QObject::connect( m_repopulateButton, SIGNAL(clicked(bool)), The::playlistActions(), SLOT(repopulateDynamicPlaylist()) );
//.........这里部分代码省略.........
示例4: aboutToSavePlaylist
PlaylistDialog::PlaylistDialog(QWidget *parent)
: QDialog(parent, Qt::Tool)
, _unsavedPlaylistModel(new QStandardItemModel(this))
, _savedPlaylistModel(new QStandardItemModel(this))
{
setupUi(this);
this->setAttribute(Qt::WA_DeleteOnClose);
unsavedPlaylists->setAttribute(Qt::WA_MacShowFocusRect, false);
savedPlaylists->setAttribute(Qt::WA_MacShowFocusRect, false);
previewPlaylist->setAttribute(Qt::WA_MacShowFocusRect, false);
delete groupBoxPreview->layout();
_stackLayout = new QStackedLayout(groupBoxPreview);
groupBoxPreview->setContentsMargins(11, 24, 11, 11);
QLabel *icon = new QLabel();
icon->setAlignment(Qt::AlignCenter);
icon->setPixmap(QPixmap(":/icons/emptyPlaylist"));
_labelEmptyPreview = new QLabel(tr("This preview area is empty.\nSelect a playlist to display the first 30 tracks."));
_labelEmptyPreview->setAlignment(Qt::AlignCenter);
_labelEmptyPreview->setWordWrap(true);
QVBoxLayout *vboxLayout = new QVBoxLayout();
vboxLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding));
vboxLayout->addWidget(icon);
vboxLayout->addWidget(_labelEmptyPreview);
vboxLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Expanding));
QWidget *widget = new QWidget();
widget->setLayout(vboxLayout);
_stackLayout->addWidget(widget);
_stackLayout->addWidget(previewPlaylist);
loadPlaylists->setIcon(this->style()->standardIcon(QStyle::SP_DialogOpenButton));
deletePlaylists->setIcon(this->style()->standardIcon(QStyle::SP_DialogCloseButton));
exportPlaylists->setIcon(this->style()->standardIcon(QStyle::SP_DialogSaveButton));
unsavedPlaylists->installEventFilter(this);
savedPlaylists->installEventFilter(this);
savedPlaylists->setDragDropMode(QListView::DropOnly);
this->installEventFilter(this);
unsavedPlaylists->setModel(_unsavedPlaylistModel);
savedPlaylists->setModel(_savedPlaylistModel);
/// XXX: MiamStyledItemDelegate should be improved!
// savedPlaylists->setItemDelegate(new MiamStyledItemDelegate(savedPlaylists, false));
connect(unsavedPlaylists->selectionModel(), &QItemSelectionModel::selectionChanged, this, &PlaylistDialog::populatePreviewFromUnsaved);
connect(savedPlaylists->selectionModel(), &QItemSelectionModel::selectionChanged, this, &PlaylistDialog::populatePreviewFromSaved);
connect(loadPlaylists, &QPushButton::clicked, this, &PlaylistDialog::loadSelectedPlaylists);
connect(savePlaylists, &QPushButton::clicked, this, [=]() {
for (QModelIndex idx : savedPlaylists->selectionModel()->selectedIndexes()) {
uint playlistId = idx.data(PlaylistID).toUInt();
for (int i = 0; i < _playlists.count(); i++) {
Playlist *p = _playlists.at(i);
if (playlistId == p->id()) {
emit aboutToSavePlaylist(p, true);
break;
}
}
}
this->updatePlaylists();
});
connect(deletePlaylists, &QPushButton::clicked, this, &PlaylistDialog::deleteSavedPlaylists);
connect(unsavedPlaylists->model(), &QStandardItemModel::rowsAboutToBeRemoved, this, &PlaylistDialog::dropAutoSavePlaylists);
connect(unsavedPlaylists->model(), &QStandardItemModel::rowsRemoved, this, [=](const QModelIndex &, int, int) {
this->updatePlaylists();
});
connect(_unsavedPlaylistModel, &QStandardItemModel::itemChanged, this, &PlaylistDialog::renameItem);
connect(_savedPlaylistModel, &QStandardItemModel::itemChanged, this, &PlaylistDialog::renameItem);
connect(exportPlaylists, &QPushButton::clicked, this, &PlaylistDialog::exportSelectedPlaylist);
}
示例5: QLabel
DecoratorDialog::DecoratorDialog(QWidget * parent, QString & s, bool visit)
: QDialog(parent, "decorator editor", TRUE), value(s) {
setCaption(TR("decorator dialog"));
Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
vbox->setMargin(5);
// multiline edit
e = new MultiLineEdit(this);
e->setText(s);
vbox->addWidget(e);
if (! visit) {
e->setFocus();
// to choose and add an decorator
QLabel * label =
new QLabel(TR("\nTo add an decorator at the cursor position\n"
"you may select it in the list and press 'add'\n"
"\nSet operation static to add @staticmethod,\n"
"set operation abstract to add @abstractmethod\n"),
this);
label->setAlignment(Qt::AlignCenter);
vbox->addWidget(label);
Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
QPushButton * add_button;
hbox->setMargin(5);
add_button = new QPushButton(TR("Add "), this);
hbox->addWidget(add_button);
connect(add_button, SIGNAL(clicked()), this, SLOT(add_decorator()));
cb = new Q3ComboBox(FALSE, this);
QSizePolicy sp = cb->sizePolicy();
sp.setHorData(QSizePolicy::Expanding);
cb->setSizePolicy(sp);
cb->setAutoCompletion(completion());
for (int i = 0;
i != sizeof(DefaultDecorators)/sizeof(*DefaultDecorators);
i += 1)
cb->insertItem(DefaultDecorators[i]);
BrowserClass::instances(decorators);
if (! decorators.isEmpty()) {
QStringList list;
decorators.full_names(list);
cb->insertStringList(list);
}
hbox->addWidget(cb);
// buttons ok, cancel
vbox->addWidget(new QLabel("", this));
hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * accept = new QPushButton(TR("&OK"), this);
QPushButton * cancel = new QPushButton(TR("&Cancel"), this);
QSize bs(cancel->sizeHint());
accept->setDefault( TRUE );
accept->setFixedSize(bs);
cancel->setFixedSize(bs);
hbox->addWidget(accept);
hbox->addWidget(cancel);
connect(accept, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
}
else {
e->setReadOnly(TRUE);
// buttons cancel
vbox->addWidget(new QLabel("", this));
Q3HBoxLayout * hbox = new Q3HBoxLayout(vbox);
hbox->setMargin(5);
QPushButton * close = new QPushButton(TR("&Close"), this);
hbox->addWidget(close);
connect(close, SIGNAL(clicked()), this, SLOT(reject()));
}
// not done in polish else the initial size is too small
UmlDesktop::setsize_center(this, previous_size, 0.3, 0.3);
}
示例6: QWidget
//.........这里部分代码省略.........
// ...and tell the layout about it.
topLayout->setMenuBar( menubar );
// Make an hbox that will hold a row of buttons.
QBoxLayout *buttons = new QHBoxLayout( topLayout );
int i;
for ( i = 1; i <= 4; i++ ) {
QPushButton* but = new QPushButton( this );
QString s;
s.sprintf( "Button %d", i );
but->setText( s );
// Set horizontal stretch factor to 10 to let the buttons
// stretch horizontally. The buttons will not stretch
// vertically, since bigWidget below will take up vertical
// stretch.
buttons->addWidget( but, 10 );
// (Actually, the result would have been the same with a
// stretch factor of 0; if no items in a layout have non-zero
// stretch, the space is divided equally between members.)
}
// Make another hbox that will hold a left-justified row of buttons.
QBoxLayout *buttons2 = new QHBoxLayout( topLayout );
QPushButton* but = new QPushButton( "Button five", this );
buttons2->addWidget( but );
but = new QPushButton( "Button 6", this );
buttons2->addWidget( but );
// Fill up the rest of the hbox with stretchable space, so that
// the buttons get their minimum width and are pushed to the left.
buttons2->addStretch( 10 );
// Make a big widget that will grab all space in the middle.
QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
bigWidget->setText( "This widget will get all the remaining space" );
bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );
// Set vertical stretch factor to 10 to let the bigWidget stretch
// vertically. It will stretch horizontally because there are no
// widgets beside it to take up horizontal stretch.
// topLayout->addWidget( bigWidget, 10 );
topLayout->addWidget( bigWidget );
// Make a grid that will hold a vertical table of QLabel/QLineEdit
// pairs next to a large QMultiLineEdit.
// Don't use hard-coded row/column numbers in QGridLayout, you'll
// regret it when you have to change the layout.
const int numRows = 3;
const int labelCol = 0;
const int linedCol = 1;
const int multiCol = 2;
// Let the grid-layout have a spacing of 10 pixels between
// widgets, overriding the default from topLayout.
QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
int row;
for ( row = 0; row < numRows; row++ ) {
QLineEdit *ed = new QLineEdit( this );
// The line edit goes in the second column
grid->addWidget( ed, row, linedCol );
// Make a label that is a buddy of the line edit
QString s;
s.sprintf( "Line &%d", row+1 );
QLabel *label = new QLabel( ed, s, this );
// The label goes in the first column.
grid->addWidget( label, row, labelCol );
}
// The multiline edit will cover the entire vertical range of the
// grid (rows 0 to numRows) and stay in column 2.
QMultiLineEdit *med = new QMultiLineEdit( this );
grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );
// The labels will take the space they need. Let the remaining
// horizontal space be shared so that the multiline edit gets
// twice as much as the line edit.
grid->setColStretch( linedCol, 10 );
grid->setColStretch( multiCol, 20 );
// Add a widget at the bottom.
QLabel* sb = new QLabel( this );
sb->setText( "Let's pretend this is a status bar" );
sb->setFrameStyle( QFrame::Panel | QFrame::Sunken );
// This widget will use all horizontal space, and have a fixed height.
// we should have made a subclass and implemented sizePolicy there...
sb->setFixedHeight( sb->sizeHint().height() );
sb->setAlignment( AlignVCenter | AlignLeft );
topLayout->addWidget( sb );
topLayout->activate();
}
示例7: format
QWidget *image_format_param_t::do_create_widgets()
{
QWidget *top = new QWidget();
menu_ = new QComboBox( top);
QSize s = menu_->sizeHint();
QLabel *label = new QLabel( top);
label->move( 0, 0);
label->resize( app().ui()->inspector().left_margin() - 5, s.height());
label->setAlignment( Qt::AlignRight | Qt::AlignVCenter);
label->setText( name().c_str());
menu_->setFocusPolicy( Qt::NoFocus);
for( int i = 0; i < image::format_t::presets().size(); ++i)
menu_->addItem( image::format_t::presets()[i].first.c_str());
menu_->addItem( "Custom");
image::format_t format( get_value<image::format_t>( *this));
menu_->move( app().ui()->inspector().left_margin(), 0);
menu_->setCurrentIndex( format.preset_index());
menu_->setEnabled( enabled());
connect( menu_, SIGNAL( currentIndexChanged( int)), this, SLOT( preset_picked(int)));
int h = s.height() + 5;
width_input_ = new ui::double_spinbox_t( top);
width_input_->setRange( 16, app().preferences().max_image_width());
width_input_->setDecimals( 0);
width_input_->setTrackMouse( false);
width_input_->setValue( value().cast<image::format_t>().width);
width_input_->move( app().ui()->inspector().left_margin(), h);
width_input_->setMinimum( 16);
width_input_->setValue( format.width);
width_input_->setEnabled( enabled());
connect( width_input_, SIGNAL( valueChanged( double)), this, SLOT( set_new_format( double)));
s = width_input_->sizeHint();
height_input_ = new ui::double_spinbox_t( top);
height_input_->setRange( 16, app().preferences().max_image_height());
height_input_->setDecimals( 0);
height_input_->setValue( value().cast<image::format_t>().height);
height_input_->setTrackMouse( false);
height_input_->setEnabled( enabled());
height_input_->move( app().ui()->inspector().left_margin() + s.width() + 5, h);
height_input_->setMinimum( 16);
height_input_->setValue( format.height);
connect( height_input_, SIGNAL( valueChanged( double)), this, SLOT( set_new_format(double)));
aspect_input_ = new ui::double_spinbox_t( top);
aspect_input_->setValue( 1);
aspect_input_->setTrackMouse( false);
aspect_input_->setEnabled( enabled());
aspect_input_->setValue( format.aspect);
aspect_input_->setDecimals( 3);
aspect_input_->setMinimum( 0.1);
aspect_input_->setSingleStep( 0.05);
aspect_input_->move( app().ui()->inspector().left_margin() + ( 2 * s.width()) + 10, h);
connect( aspect_input_, SIGNAL( valueChanged( double)), this, SLOT( set_new_format(double)));
h += s.height() + 5;
int w = ( width_input_->sizeHint().width() * 2) + aspect_input_->sizeHint().width() + 10;
menu_->resize( w, menu_->sizeHint().height());
top->setMinimumSize( app().ui()->inspector().width(), h);
top->setMaximumSize( app().ui()->inspector().width(), h);
top->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed);
return top;
}
示例8: analysisFinished
void DetailWindow::analysisFinished(){
QString error = analysisWatcher.result().errorMessage;
if(error != ""){
say(error);
cleanUpAfterRun();
return;
}
// Title bar
TagLibMetadata md(filePath);
QString shortName = md.getTitle();
if(shortName == "")
shortName = filePath.mid(filePath.lastIndexOf("/") + 1);
this->setWindowTitle(GuiStrings::getInstance()->appName() + GuiStrings::getInstance()->delim() + tr("Detailed Analysis") + GuiStrings::getInstance()->delim() + shortName);
// full chromagram
chromagramImage = imageFromChromagram(analysisWatcher.result().core.fullChromagram);
ui->chromagramLabel->setPixmap(QPixmap::fromImage(chromagramImage));
ui->chromagramLabel->setMinimumHeight(analysisWatcher.result().core.fullChromagram.getBins()+2);
ui->chromagramLabel->setMinimumWidth(analysisWatcher.result().core.fullChromagram.getHops()+2);
// one octave chromagram
miniChromagramImage = imageFromChromagram(analysisWatcher.result().core.oneOctaveChromagram);
ui->miniChromagramLabel->setPixmap(QPixmap::fromImage(miniChromagramImage));
//: A tooltip on the Detail window
ui->miniChromagramLabel->setToolTip(wrapToolTip(tr("This is the same chromagram data, reduced to a single octave.")));
// harmonic change signal
int rateOfChangePrecision = 100;
int size = (signed)analysisWatcher.result().core.harmonicChangeSignal.size();
harmonicChangeImage = QImage(size*chromaScaleH,rateOfChangePrecision,QImage::Format_Indexed8);
prefs.setImageColours(harmonicChangeImage,ui->chromaColourCombo->currentIndex());
for(int h=0; h<size; h++){
int value = analysisWatcher.result().core.harmonicChangeSignal[h] * rateOfChangePrecision;
for(int y=0; y<rateOfChangePrecision; y++)
for(int x=0; x<chromaScaleH; x++)
harmonicChangeImage.setPixel(h*chromaScaleH+x, y, (rateOfChangePrecision - y > value ? 0 : 50));
}
ui->harmonicChangeLabel->setPixmap(QPixmap::fromImage(harmonicChangeImage));
// Tooltip
if(prefs.getSegmentation() == 'n'){
//: A tooltip on the Detail window
ui->harmonicChangeLabel->setToolTip(wrapToolTip(tr("You are not using segmentation, so there is no harmonic change data to display.")));
}else if(prefs.getSegmentation() == 'a'){
//: A tooltip on the Detail window
ui->harmonicChangeLabel->setToolTip(wrapToolTip(tr("You are using arbitrary segmentation, so there is no harmonic change data to display.")));
}else{
//: A tooltip on the Detail window
ui->harmonicChangeLabel->setToolTip(wrapToolTip(tr("This is the level of harmonic change detected in the chromagram over time. Peaks in this signal are used to segment the chromagram.")));
}
// Key estimates
deleteKeyLabels();
int lastChange = -1; // enable correct stretch policy for first segment
for(int h = 0; h < (signed)analysisWatcher.result().core.segments.size(); h++){
QLabel* newLabel = new QLabel(prefs.getKeyCode(analysisWatcher.result().core.segments[h].key));
newLabel->setAlignment(Qt::AlignCenter);
QPalette pal = newLabel->palette();
pal.setColor(backgroundRole(), prefs.getKeyColour(analysisWatcher.result().core.segments[h].key));
newLabel->setPalette(pal);
newLabel->setFrameStyle(1);
newLabel->setAutoFillBackground(true);
newLabel->setMinimumHeight(20);
newLabel->setMaximumHeight(30);
if(prefs.getSegmentation() == 'n'){
//: A tooltip on the Detail window
newLabel->setToolTip(wrapToolTip(tr("This row shows the key estimate for the unsegmented chromagram.")));
}else if(prefs.getSegmentation() == 'a'){
//: A tooltip on the Detail window
newLabel->setToolTip(wrapToolTip(tr("This row shows the key estimates for the arbitrary segments.")));
}else{
//: A tooltip on the Detail window
newLabel->setToolTip(wrapToolTip(tr("This row shows the key estimates for the segments between peak harmonic changes.")));
}
ui->horizontalLayout_keyLabels->addWidget(newLabel, h - lastChange);
keyLabels.push_back(newLabel);
lastChange = h;
}
//: Text in the Batch window status bar; includes a key code at %1
say(tr("Key estimate: %1").arg(prefs.getKeyCode(analysisWatcher.result().core.globalKeyEstimate)));
cleanUpAfterRun();
}
示例9: rx
Donate::Donate(QWidget *parent) : QDialog(parent)
{
resize(400, 0);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
// Initialize "Thanks" section:
QString thanks = QString("<hr>%1:<br>").arg(tr("Thank you for your support"));
QRegExp rx("\\((.+)\\)");
rx.setMinimal(true);
QFile inputFile(APPDIR + "/authors.txt");
if (inputFile.open(QIODevice::ReadOnly)) {
QTextStream stream(&inputFile);
while (!stream.atEnd()) {
QString line = stream.readLine();
if (line == "Supported by:") {
while (!line.isEmpty() && !stream.atEnd()) {
line = stream.readLine();
line = line.replace(rx, "(<a href=\"\\1\">\\1</a>)");
thanks += line + "<br>";
}
thanks.chop(8);
break;
}
}
inputFile.close();
}
// Create GUI:
QGridLayout *grid = new QGridLayout(this);
QLabel *donators = new QLabel(this);
donators->setAlignment(Qt::AlignCenter);
donators->setTextFormat(Qt::RichText);
donators->setOpenExternalLinks(true);
donators->setText(thanks);
QLabel *titlePayPal = new QLabel("PayPal", this);
QLabel *titleBitCoin = new QLabel("BitCoin", this);
QLineEdit *fieldPayPal = new QLineEdit(PAYPAL, this);
QLineEdit *fieldBitCoin = new QLineEdit(BITCOIN, this);
fieldPayPal->setReadOnly(true);
fieldBitCoin->setReadOnly(true);
fieldPayPal->setCursor(Qt::IBeamCursor);
fieldBitCoin->setCursor(Qt::IBeamCursor);
QToolButton *btnPayPal = new QToolButton(this);
QToolButton *btnBitCoin = new QToolButton(this);
btnPayPal->setIcon(QIcon(":/gfx/actions/copy.png"));
btnBitCoin->setIcon(QIcon(":/gfx/actions/copy.png"));
btnPayPal->setToolTip(tr("Copy to Clipboard"));
btnBitCoin->setToolTip(tr("Copy to Clipboard"));
QPushButton *btnOk = new QPushButton("OK", this);
grid->addWidget(titlePayPal, 0, 0);
grid->addWidget(fieldPayPal, 0, 1);
grid->addWidget(btnPayPal, 0, 2);
grid->addWidget(titleBitCoin, 1, 0);
grid->addWidget(fieldBitCoin, 1, 1);
grid->addWidget(btnBitCoin, 1, 2);
grid->addWidget(btnOk, 2, 1);
grid->addWidget(donators, 3, 1);
connect(btnPayPal, SIGNAL(clicked()), this, SLOT(copyPayPal()));
connect(btnBitCoin, SIGNAL(clicked()), this, SLOT(copyBitCoin()));
connect(btnOk, SIGNAL(clicked()), this, SLOT(accept()));
}
示例10: it
ActionWidget::ActionWidget( const ActionList *list, ConfigDialog* configWidget, QWidget *parent,
const char *name )
: KVBox( parent ),
advancedWidget( 0L )
{
setObjectName(name);
Q_ASSERT( list != 0L );
QLabel *lblAction = new QLabel(
i18n("Action &list (right click to add/remove commands):"), this );
listView = new ListView( configWidget, this );
lblAction->setBuddy( listView );
listView->addColumn( i18n("Regular Expression (see http://doc.trolltech.com/qregexp.html#details)") );
listView->addColumn( i18n("Description") );
listView->setRenameable(0);
listView->setRenameable(1);
listView->setItemsRenameable( true );
listView->setItemsMovable( false );
// listView->setAcceptDrops( true );
// listView->setDropVisualizer( true );
// listView->setDragEnabled( true );
listView->setRootIsDecorated( true );
listView->setMultiSelection( false );
listView->setAllColumnsShowFocus( true );
listView->setSelectionMode( Q3ListView::Single );
connect( listView, SIGNAL(executed( Q3ListViewItem*, const QPoint&, int )),
SLOT( slotItemChanged( Q3ListViewItem*, const QPoint& , int ) ));
connect( listView, SIGNAL( selectionChanged ( Q3ListViewItem * )),
SLOT(selectionChanged ( Q3ListViewItem * )));
connect(listView,
SIGNAL(contextMenu(K3ListView *, Q3ListViewItem *, const QPoint&)),
SLOT( slotContextMenu(K3ListView*, Q3ListViewItem*, const QPoint&)));
ClipAction *action = 0L;
ClipCommand *command = 0L;
Q3ListViewItem *item = 0L;
Q3ListViewItem *child = 0L;
Q3ListViewItem *after = 0L; // QListView's default inserting really sucks
ActionListIterator it( *list );
const QPixmap& doc = SmallIcon( "misc" );
const QPixmap& exec = SmallIcon( "exec" );
for ( action = it.current(); action; action = ++it ) {
item = new Q3ListViewItem( listView, after,
action->regExp(), action->description() );
item->setPixmap( 0, doc );
Q3PtrListIterator<ClipCommand> it2( action->commands() );
for ( command = it2.current(); command; command = ++it2 ) {
child = new Q3ListViewItem( item, after,
command->command, command->description);
if ( command->pixmap.isEmpty() )
child->setPixmap( 0, exec );
else
child->setPixmap( 0, SmallIcon( command->pixmap ) );
after = child;
}
after = item;
}
listView->setSorting( -1 ); // newly inserted items just append unsorted
cbUseGUIRegExpEditor = new QCheckBox( i18n("&Use graphical editor for editing regular expressions" ), this );
if ( KServiceTypeTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty() )
{
cbUseGUIRegExpEditor->hide();
cbUseGUIRegExpEditor->setChecked( false );
}
KHBox *box = new KHBox( this );
box->setSpacing( KDialog::spacingHint() );
QPushButton *button = new QPushButton( i18n("&Add Action"), box );
connect( button, SIGNAL( clicked() ), SLOT( slotAddAction() ));
delActionButton = new QPushButton( i18n("&Delete Action"), box );
connect( delActionButton, SIGNAL( clicked() ), SLOT( slotDeleteAction() ));
QLabel *label = new QLabel(i18n("Click on a highlighted item's column to change it. \"%s\" in a command will be replaced with the clipboard contents."), box);
label->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
label->setWordWrap( true );
box->setStretchFactor( label, 5 );
box = new KHBox( this );
QPushButton *advanced = new QPushButton( i18n("Advanced..."), box );
advanced->setFixedSize( advanced->sizeHint() );
connect( advanced, SIGNAL( clicked() ), SLOT( slotAdvanced() ));
(void) new QWidget( box ); // spacer
delActionButton->setEnabled(listView->currentItem () !=0);
}
示例11: QWidget
GeneralTab::GeneralTab(const QString &fileName, QWidget *parent) :
QWidget(parent)
{
QGroupBox *communicationGroup = new QGroupBox(COMMUNICATION_CONFIG);
QLabel *ipLabel = new QLabel(COMMUNICATION_IP);
ipLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_pIpEdit = new QLineEdit();
m_pIpEdit->setText(tr("127.0.0.1"));
QLabel *srcPortLabel = new QLabel(COMMUNICATION_SRCPORT);
srcPortLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_pSrcPortEdit = new QLineEdit();
m_pSrcPortEdit->setText(tr("6009"));
QLabel *destPortLabel = new QLabel(COMMUNICATION_DESTPORT);
destPortLabel->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_pDestPortEdit = new QLineEdit();
m_pDestPortEdit->setText(tr("6008"));
QLabel *askLabel = new QLabel(QStringLiteral("转发表功能:"));
m_pYesRButton = new QRadioButton(QStringLiteral("启用"));
m_pNoRButton = new QRadioButton(QStringLiteral("禁用"));
m_pAskGrp = new QButtonGroup();
m_pAskGrp->addButton(m_pYesRButton, 0);
m_pAskGrp->addButton(m_pNoRButton, 1);
m_pNoRButton->setChecked(true);
connect(m_pAskGrp, SIGNAL(buttonReleased(int)), this, SLOT(changeTransPage(int)));
QHBoxLayout *rbLayout = new QHBoxLayout();
rbLayout->addWidget(m_pYesRButton);
rbLayout->addWidget(m_pNoRButton);
/////////////////////////////////////////////////////////////////
m_pTransWidget = new QStackedWidget;
m_pTransPage = new TransPage;
m_pTransWidget->addWidget(m_pTransPage);
m_pTransWidget->addWidget(new ReservePage);
m_pTransWidget->setCurrentIndex(1);
QGridLayout *gridLayout = new QGridLayout();
//gridLayout->setSpacing(6);
//gridLayout->setContentsMargins(40, 10, 40, 10);
//gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
gridLayout->addWidget(ipLabel, 0, 0, 1, 1);
gridLayout->addWidget(m_pIpEdit, 0, 1, 1, 1);
gridLayout->addWidget(srcPortLabel, 1, 0, 1, 1);
gridLayout->addWidget(m_pSrcPortEdit, 1, 1, 1, 1);
gridLayout->addWidget(destPortLabel, 2, 0, 1, 1);
gridLayout->addWidget(m_pDestPortEdit, 2, 1, 1, 1);
gridLayout->addWidget(askLabel, 3, 0, 1, 1);
gridLayout->addLayout(rbLayout, 3, 1, 1, 1);
gridLayout->addWidget(m_pTransWidget, 4, 0, 1, 2);
communicationGroup->setLayout(gridLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(communicationGroup);
mainLayout->addStretch(1);
this->setLayout(mainLayout);
SERVER_INFO Server;
XmlParser parser;
if (parser.readXml(fileName, XML_ELEMENT_SERVERINFO, &Server))
{
//qDebug() << fileName;
m_pIpEdit->setText(Server.ip);
m_pSrcPortEdit->setText(Server.srcPort);
m_pDestPortEdit->setText(Server.destPort);
m_pTransPage->setTransPort(Server.transPort);
if(Server.transEnable.toInt())
{
m_pYesRButton->setChecked(true);
m_pTransWidget->setCurrentIndex(0);
}
}
}
示例12: QWidget
PTabDisplComp::PTabDisplComp(QMyTabWidget* _container, int _tab_index) : QWidget(), container(_container), tab_index(_tab_index)
{
#ifdef TSP_DEBUG
printf("TeraStitcher plugin [thread %d] >> PTabDisplComp created\n", this->thread()->currentThreadId());
#endif
//creating Basic panel widgets
basic_panel = new QWidget();
saveproj_label = new QLabel("Save project XML to:");
saveproj_field = new QLineEdit();
saveproj_field->setFont(QFont("",8));
browse_button = new QPushButton("...");
algorithm_label = new QLabel("Algorithm:");
algorithm_cbox = new QComboBox();
algorithm_cbox->insertItem(0, "MIP-NCC");
algorithm_cbox->setEditable(true);
algorithm_cbox->lineEdit()->setReadOnly(true);
algorithm_cbox->lineEdit()->setAlignment(Qt::AlignCenter);
for(int i = 0; i < algorithm_cbox->count(); i++)
algorithm_cbox->setItemData(i, Qt::AlignCenter, Qt::TextAlignmentRole);
subvoldims_label = new QLabel("Number of slices per layer:");
subvoldims_sbox = new QSpinBox();
subvoldims_sbox->setAlignment(Qt::AlignCenter);
subvoldims_sbox->setMaximum(600);
subvoldims_sbox->setMinimum(1);
memocc_label = new QLabel("Estimated memory usage:");
memocc_field = new QLineEdit();
memocc_field->setReadOnly(true);
memocc_field->setAlignment(Qt::AlignCenter);
channel_selection = new QComboBox();
channel_selection->addItem("all channels");
channel_selection->addItem("R");
channel_selection->addItem("G");
channel_selection->addItem("B");
channel_selection->setEditable(true);
channel_selection->lineEdit()->setReadOnly(true);
channel_selection->lineEdit()->setAlignment(Qt::AlignCenter);
for(int i = 0; i < channel_selection->count(); i++)
channel_selection->setItemData(i, Qt::AlignCenter, Qt::TextAlignmentRole);
connect(channel_selection, SIGNAL(currentIndexChanged(int)),this, SLOT(channelSelectedChanged(int)));
showAdvancedButton = new QPushButton(QString("Advanced options ").append(QChar(0x00BB)), this);
showAdvancedButton->setCheckable(true);
//creating Advanced panel widgets
advanced_panel = new QWidget();
stackrowstbp_label = new QLabel("Data subset selection (rows):");
startrow_sbox = new QSpinBox();
startrow_sbox->setAlignment(Qt::AlignCenter);
to_label_1 = new QLabel("to");
to_label_1->setAlignment(Qt::AlignCenter);
endrow_sbox = new QSpinBox();
endrow_sbox->setAlignment(Qt::AlignCenter);
stackcolstbp_label = new QLabel("Data subset selection (columns):");
startcol_sbox = new QSpinBox();
startcol_sbox->setAlignment(Qt::AlignCenter);
to_label_2 = new QLabel("to");
to_label_2->setAlignment(Qt::AlignCenter);
endcol_sbox = new QSpinBox();
endcol_sbox->setAlignment(Qt::AlignCenter);
startslice_sbox = new QSpinBox();
startslice_sbox->setAlignment(Qt::AlignCenter);
endslice_sbox = new QSpinBox();
endslice_sbox->setAlignment(Qt::AlignCenter);
searchregion_label = new QLabel("Search Region (voxels):");
Ysearch_sbox = new QSpinBox();
Ysearch_sbox->setAlignment(Qt::AlignCenter);
Ysearch_sbox->setMinimum(5);
Ysearch_sbox->setValue(20);
Ysearch_sbox->setSuffix(" (Y)");
Xsearch_sbox = new QSpinBox();
Xsearch_sbox->setAlignment(Qt::AlignCenter);
Xsearch_sbox->setMinimum(5);
Xsearch_sbox->setValue(20);
Xsearch_sbox->setSuffix(" (X)");
Zsearch_sbox = new QSpinBox();
Zsearch_sbox->setAlignment(Qt::AlignCenter);
Zsearch_sbox->setMinimum(5);
Zsearch_sbox->setValue(20);
Zsearch_sbox->setSuffix(" (Z)");
for_label_1 = new QLabel(QChar(0x00D7));
for_label_1->setAlignment(Qt::AlignCenter);
for_label_2 = new QLabel(QChar(0x00D7));
for_label_2->setAlignment(Qt::AlignCenter);
overlap_label = new QLabel("Overlap (voxels):");
Yoverlap_sbox = new QSpinBox();
Yoverlap_sbox->setAlignment(Qt::AlignCenter);
Yoverlap_sbox->setSuffix(" (Y)");
Xoverlap_sbox = new QSpinBox();
Xoverlap_sbox->setAlignment(Qt::AlignCenter);
Xoverlap_sbox->setSuffix(" (X)");
for_label_3 = new QLabel(QChar(0x00D7));
for_label_3->setAlignment(Qt::AlignCenter);
restoreSPIM_label = new QLabel("SPIM artifacts removal:");
restoreSPIM_cbox = new QCheckBox("Compute stacks profiles to be used in the Merging tiles step");
/*** LAYOUT SECTIONS ***/
//basic panel
//.........这里部分代码省略.........
示例13: QWidget
ImportFields::ImportFields(QWidget *parent,const char *name)
: QWidget(parent,name)
{
QLabel *label;
import_changed=false;
//
// Traffic Cartname Parser Data Section
//
label=new QLabel(tr("Cart Number:"),this,
"_cartname_label");
label->setGeometry(0,0,120,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
//
// Traffic Cart Offset
//
cart_offset_spin=new QSpinBox(this,"cart_offset_spin");
cart_offset_spin->setGeometry(175,0,50,19);
cart_offset_spin->setRange(0,1024);
label=new QLabel(cart_offset_spin,
tr("Offset:"),this,
"cart_win_path_label");
label->setGeometry(125,0,45,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
connect(cart_offset_spin,SIGNAL(valueChanged(int)),
this,SLOT(valueChangedData(int)));
//
// Traffic Cart Length
//
cart_length_spin=new QSpinBox(this,"cart_length_spin");
cart_length_spin->setGeometry(285,0,50,19);
cart_length_spin->setRange(0,6);
label=new QLabel(cart_length_spin,
tr("Length:"),this,
"cart_win_path_label");
label->setGeometry(230,0,50,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
connect(cart_length_spin,SIGNAL(valueChanged(int)),
this,SLOT(valueChangedData(int)));
//
// Title Parser Data Section
//
label=new QLabel(tr("Title:"),this,"_cartname_label");
label->setGeometry(0,21,120,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
//
// Title Cart Offset
//
title_offset_spin=new QSpinBox(this,"title_offset_spin");
title_offset_spin->setGeometry(175,21,50,19);
title_offset_spin->setRange(0,1024);
label=new QLabel(title_offset_spin,
tr("Offset:"),this,
"title_win_path_label");
label->setGeometry(125,21,45,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
connect(title_offset_spin,SIGNAL(valueChanged(int)),
this,SLOT(valueChangedData(int)));
//
// Title Cart Length
//
title_length_spin=new QSpinBox(this,"title_length_spin");
title_length_spin->setGeometry(285,21,50,19);
title_length_spin->setRange(0,255);
label=new QLabel(title_length_spin,
tr("Length:"),this,
"title_win_path_label");
label->setGeometry(230,21,50,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
connect(title_length_spin,SIGNAL(valueChanged(int)),
this,SLOT(valueChangedData(int)));
//
// Traffic Start Hours Parser Data Section
//
label=new QLabel(tr("Start Time - Hours:"),this,
"_startname_label");
label->setGeometry(0,42,120,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
//
// Traffic Start Hours Offset
//
hours_offset_spin=new QSpinBox(this,"hours_offset_spin");
hours_offset_spin->setGeometry(175,42,50,19);
hours_offset_spin->setRange(0,RD_MAX_IMPORT_LINE_LENGTH);
label=new QLabel(hours_offset_spin,
tr("Offset:"),this,
"hours_win_path_label");
label->setGeometry(125,42,45,19);
label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);
connect(hours_offset_spin,SIGNAL(valueChanged(int)),
this,SLOT(valueChangedData(int)));
//
//.........这里部分代码省略.........
示例14: if
ConstrDestrCopyDialog::ConstrDestrCopyDialog(UmlClass * cl, bool have_constructor,
bool have_destructor, bool have_copy,
bool have_const_copy, bool have_assignment,
bool have_const_assignment)
: QDialog(0, 0, TRUE), target(cl) {
QVBoxLayout * vbox = new QVBoxLayout(this);
QHGroupBox * g;
QList<QLabel> labels;
QLabel * lbl;
vbox->setSpacing(5);
vbox->setMargin(5);
lbl = new QLabel(QString("<big><b>C++ utilities for the class <i><tt>") +
(const char *) cl->name() + "</tt></i></b></big>",
this);
lbl->setAlignment(AlignCenter);
vbox->addWidget(lbl);
// constructor
g = new QHGroupBox(this);
vbox->addWidget(g);
labels.append(new QLabel((have_constructor)
? "the class already have contructor "
: "the class doesn't have contructor ",
g));
QHBox * h = new QHBox(g);
add_constr = new QCheckBox("add constructor", h);
constr_explicit = new QCheckBox("explicit", h);
// destructor
if (! have_destructor) {
g = new QHGroupBox(this);
vbox->addWidget(g);
labels.append(new QLabel("the class doesn't have destructor ",
g));
h = new QHBox(g);
add_destr = new QCheckBox("add destructor", h);
virtual_destr = new QCheckBox("virtual", h);
}
else
add_destr = 0;
// copy contructor
if (have_copy) {
add_copy = 0;
if (!have_const_copy) {
g = new QHGroupBox(this);
vbox->addWidget(g);
labels.append(new QLabel("the class doesn't have copy contructor \nwith const argument ",
g));
add_const_copy = new QCheckBox("add copy constructor\nwith const argument",
g);
}
else
add_const_copy = 0;
}
else if (!have_const_copy) {
g = new QHGroupBox(this);
vbox->addWidget(g);
labels.append(new QLabel("the class doesn't have copy contructor ",
g));
QVBox * v = new QVBox(g);
add_const_copy = new QCheckBox("add copy constructor\nwith const argument",
v);
add_copy = new QCheckBox("add copy constructor\nwith non const argument",
v);
}
else {
g = new QHGroupBox(this);
vbox->addWidget(g);
labels.append(new QLabel("the class doesn't have copy contructor \nwith non const argument ",
g));
add_copy = new QCheckBox("add copy constructor\nwith non const argument",
g);
add_const_copy = 0;
}
// assignment
if (have_assignment) {
add_assign = 0;
if (!have_const_assignment) {
g = new QHGroupBox(this);
vbox->addWidget(g);
//.........这里部分代码省略.........
示例15: TAAWidget
MakeDeposits::MakeDeposits
(
QWidget* parent,
const char* name
) : TAAWidget(parent)
{
setCaption( "Make Deposits" );
// Create our widgets.
paymentList = new Q3ListView(this, "paymentList");
int curCol = 1;
paymentList->addColumn("Date"); curCol++;
paymentList->addColumn("Cust ID"); curCol++;
paymentList->addColumn("Customer Name"); curCol++;
paymentList->addColumn("Check No"); curCol++;
paymentList->addColumn("Amount"); curCol++;
paymentList->addColumn("IntID");
paymentList->setColumnAlignment(curCol++, AlignRight);
paymentList->setAllColumnsShowFocus(true);
paymentList->setMultiSelection(true);
connect(paymentList, SIGNAL(selectionChanged()), this, SLOT(itemSelected()));
connect(paymentList, SIGNAL(doubleClicked(Q3ListViewItem *)), this, SLOT(itemDoubleClicked(Q3ListViewItem *)));
QLabel *selectedItemCountLabel = new QLabel(this, "selectedItemCountLabel");
selectedItemCountLabel->setText("Items Selected:");
selectedItemCountLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
selectedItemCount = new QLabel(this, "selectedItemCount");
selectedItemCount->setText("0");
selectedItemCount->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
QLabel *undepositedAmountLabel = new QLabel(this, "undepositedAmountLabel");
undepositedAmountLabel->setText("Undeposted amount:");
undepositedAmountLabel->setAlignment(AlignRight | AlignVCenter);
undepositedAmount = new QLabel(this, "undepositedAmount");
undepositedAmount->setText("$0.00");
undepositedAmount->setAlignment(AlignRight | AlignVCenter);
QLabel *amountSelectedLabel = new QLabel(this, "amountSelectedLabel");
amountSelectedLabel->setText("Amount selected:");
amountSelectedLabel->setAlignment(AlignRight | AlignVCenter);
amountSelected = new QLabel(this, "amountSelected");
amountSelected->setText("$0.00");
amountSelected->setAlignment(AlignRight | AlignVCenter);
QLabel *targetAccountLabel = new QLabel(this, "targetAccountLabel");
targetAccountLabel->setText("Target Account:");
targetAccountLabel->setAlignment(AlignRight | AlignVCenter);
targetAccountList = new QComboBox(false, this, "targetAccountList");
QLabel *transDateLabel = new QLabel(this, "transDateLabel");
transDateLabel->setText("Desposit Date:");
transDateLabel->setAlignment(AlignRight | AlignVCenter);
transDate = new Q3DateEdit(QDate::currentDate(), this, "transDate");
// Our buttons now.
QPushButton *printButton = new QPushButton(this, "printButton");
printButton->setText("&Print");
connect(printButton, SIGNAL(clicked()), this, SLOT(printSelected()));
QPushButton *selectAllButton = new QPushButton(this, "selectAllButton");
selectAllButton->setText("Select &All");
connect(selectAllButton, SIGNAL(clicked()), this, SLOT(selectAll()));
QPushButton *selectNoneButton = new QPushButton(this, "selectNoneButton");
selectNoneButton->setText("Select &None");
connect(selectNoneButton, SIGNAL(clicked()), this, SLOT(selectNone()));
QPushButton *continueButton = new QPushButton(this, "continueButton");
continueButton->setText("C&ontinue");
connect(continueButton, SIGNAL(clicked()), this, SLOT(processSelections()));
QPushButton *cancelButton = new QPushButton(this, "cancelButton");
cancelButton->setText("&Cancel");
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelSelected()));
// Create our layout.
Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 3, 3);
ml->addWidget(paymentList, 1);
// A grid for our labels and account selection.
Q3GridLayout *asl = new Q3GridLayout(3, 2);
asl->setColStretch(0, 0);
asl->setColStretch(1, 1);
int curRow = 0;
asl->addWidget(selectedItemCountLabel, curRow, 0);
asl->addWidget(selectedItemCount, curRow, 1);
asl->setRowStretch(curRow++, 0);
asl->addWidget(undepositedAmountLabel, curRow, 0);
asl->addWidget(undepositedAmount, curRow, 1);
asl->setRowStretch(curRow++, 0);
asl->addWidget(amountSelectedLabel, curRow, 0);
asl->addWidget(amountSelected, curRow, 1);
asl->setRowStretch(curRow++, 0);
//.........这里部分代码省略.........