本文整理汇总了C++中KHBox类的典型用法代码示例。如果您正苦于以下问题:C++ KHBox类的具体用法?C++ KHBox怎么用?C++ KHBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KHBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QFrame
TimeSelector::TimeSelector(const QString& selectText, const QString& postfix, const QString& selectWhatsThis,
const QString& valueWhatsThis, bool allowHourMinute, QWidget* parent)
: QFrame(parent),
mLabel(0),
mReadOnly(false)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(KDialog::spacingHint());
mSelect = new CheckBox(selectText, this);
mSelect->setFixedSize(mSelect->sizeHint());
connect(mSelect, SIGNAL(toggled(bool)), SLOT(selectToggled(bool)));
mSelect->setWhatsThis(selectWhatsThis);
layout->addWidget(mSelect);
KHBox* box = new KHBox(this); // to group widgets for QWhatsThis text
box->setSpacing(KDialog::spacingHint());
layout->addWidget(box);
mPeriod = new TimePeriod(allowHourMinute, box);
mPeriod->setFixedSize(mPeriod->sizeHint());
mPeriod->setSelectOnStep(false);
connect(mPeriod, SIGNAL(valueChanged(const KCal::Duration&)), SLOT(periodChanged(const KCal::Duration&)));
mSelect->setFocusWidget(mPeriod);
mPeriod->setEnabled(false);
if (!postfix.isEmpty())
{
mLabel = new QLabel(postfix, box);
mLabel->setEnabled(false);
}
box->setWhatsThis(valueWhatsThis);
layout->addStretch();
}
示例2: KPWizardPage
PreProcessingPage::PreProcessingPage(Manager* const mngr, KAssistantDialog* const dlg)
: KPWizardPage(dlg, i18n("<b>Pre-Processing Images</b>")),
d(new PreProcessingPagePriv)
{
d->mngr = mngr;
d->progressTimer = new QTimer(this);
KVBox* vbox = new KVBox(this);
d->title = new QLabel(vbox);
d->title->setWordWrap(true);
d->title->setOpenExternalLinks(true);
KConfig config("kipirc");
KConfigGroup group = config.group(QString("Panorama Settings"));
d->celesteCheckBox = new QCheckBox(i18n("Detect moving skies"), vbox);
d->celesteCheckBox->setChecked(group.readEntry("Celeste", false));
d->celesteCheckBox->setToolTip(i18n("Automatic detection of clouds to prevent wrong keypoints matching "
"between images due to moving clouds."));
d->celesteCheckBox->setWhatsThis(i18n("<b>Detect moving skies</b>: During the control points selection and matching, "
"this option discards any points that are associated to a possible cloud. This "
"is useful to prevent moving clouds from altering the control points matching "
"process."));
QLabel* space1 = new QLabel(vbox);
KHBox* hbox = new KHBox(vbox);
d->detailsBtn = new QPushButton(hbox);
d->detailsBtn->setText(i18n("Details..."));
d->detailsBtn->hide();
QLabel* space2 = new QLabel(hbox);
hbox->setStretchFactor(space2, 10);
QLabel* space3 = new QLabel(vbox);
d->progressLabel = new QLabel(vbox);
d->progressLabel->setAlignment(Qt::AlignCenter);
QLabel* space4 = new QLabel(vbox);
vbox->setStretchFactor(space1, 2);
vbox->setStretchFactor(space3, 2);
vbox->setStretchFactor(space4, 10);
vbox->setSpacing(KDialog::spacingHint());
vbox->setMargin(KDialog::spacingHint());
setPageWidget(vbox);
resetTitle();
QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_panorama/pics/assistant-preprocessing.png");
setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));
// connect(d->mngr->thread(), SIGNAL(starting(KIPIPanoramaPlugin::ActionData)),
// this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData)));
connect(d->progressTimer, SIGNAL(timeout()),
this, SLOT(slotProgressTimerDone()));
connect(d->detailsBtn, SIGNAL(clicked()),
this, SLOT(slotShowDetails()));
}
示例3: QWidget
SQLiteServerPrefs::SQLiteServerPrefs( QWidget *parent ) : QWidget( parent )
{
QVBoxLayout * Form1Layout = new QVBoxLayout( this );
KHBox *hbox = new KHBox( this );
( void ) new QLabel( i18n( "Database file:" ), hbox );
Form1Layout->addWidget( hbox );
QSpacerItem* spacerRow5 = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding );
Form1Layout->addItem( spacerRow5 );
QString sqliteBinary = "sqlite3";
// Backup options
QGroupBox *backupGBox = new QGroupBox( this );
backupGBox->setTitle( i18nc( "@title:group Backup options", "Backup" ) );
QFormLayout *backupGBoxLayout = new QFormLayout;
backupGBox->setLayout( backupGBoxLayout );
dumpPathRequester = new KUrlRequester;
dumpPathRequester->fileDialog()->setCaption( i18n( "Select SQLite command" ) );
backupGBoxLayout->addRow( i18n( "Path to '%1':", sqliteBinary ), dumpPathRequester );
Form1Layout->addWidget( backupGBox );
// SQLite converter options
QGroupBox *converterGBox = new QGroupBox( this );
converterGBox->setTitle( i18n( "SQLite converter" ) );
QFormLayout *converterGBoxLayout = new QFormLayout;
converterGBox->setLayout( converterGBoxLayout );
oldPathRequester = new KUrlRequester;
oldPathRequester->fileDialog()->setCaption( i18n( "Select old SQLite version command" ) );
converterGBoxLayout->addRow( i18n( "Path to SQLite old version command:" ), oldPathRequester );
newPathRequester = new KUrlRequester;
newPathRequester->fileDialog()->setCaption( i18n( "Select new SQLite version command" ) );
converterGBoxLayout->addRow( i18n( "Path to SQLite new version command:" ), newPathRequester );
Form1Layout->addWidget( converterGBox );
// Load Current Settings
KConfigGroup config = KGlobal::config()->group( "Server" );
fileRequester = new KUrlRequester( config.readEntry( "DBFile", KStandardDirs::locateLocal( "appdata", "krecipes.krecdb" ) ), hbox );
fileRequester->fileDialog()->setCaption( i18n( "Select SQLite database file" ) );
hbox->setStretchFactor( fileRequester, 2 );
dumpPathRequester->setUrl( config.readEntry( "SQLitePath", sqliteBinary ) );
dumpPathRequester->setFilter( sqliteBinary + "\n*|" + i18n( "All files" ) );
oldPathRequester->setUrl( config.readEntry( "SQLiteOldVersionPath", "sqlite" ) );
oldPathRequester->setFilter( "sqlite\n*|" + i18n( "All files" ) );
newPathRequester->setUrl( config.readEntry( "SQLiteNewVersionPath", "sqlite3" ) );
newPathRequester->setFilter( "sqlite3\n*|" + i18n( "All files" ) );
}
示例4: QToolButton
VolumePopupButton::VolumePopupButton( QWidget * parent, PlayerManager *mgr ) :
QToolButton( parent ),
m_prevVolume(0.0),
m_curVolume(0.0),
player(mgr)
{
//create the volume popup
m_volumeMenu = new QMenu( this );
KVBox *mainBox = new KVBox( this );
m_volumeLabel= new QLabel( mainBox );
m_volumeLabel->setAlignment( Qt::AlignHCenter );
KHBox *sliderBox = new KHBox( mainBox );
m_volumeSlider = new VolumeSlider( 100, sliderBox, false );
m_volumeSlider->setFixedHeight( 170 );
mainBox->setMargin( 0 );
mainBox->setSpacing( 0 );
sliderBox->setSpacing( 0 );
sliderBox->setMargin( 0 );
mainBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
sliderBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
QWidgetAction *sliderActionWidget = new QWidgetAction( this );
sliderActionWidget->setDefaultWidget( mainBox );
// volumeChanged is a customSignal, is not emited by setValue()
connect( m_volumeSlider, SIGNAL(volumeChanged(float)), player, SLOT(setVolume(float)) );
QToolBar *muteBar = new QToolBar( QString(), mainBox );
muteBar->setContentsMargins( 0, 0, 0, 0 );
muteBar->setIconSize( QSize( 16, 16 ) );
// our popup's mute-toggle button
m_muteAction = new QAction( KIcon( "audio-volume-muted" ), QString(), muteBar );
m_muteAction->setToolTip( i18n( "Mute/Unmute" ) );
connect( m_muteAction, SIGNAL(triggered(bool)), this, SLOT(slotToggleMute(bool)) );
connect( player, SIGNAL(mutedChanged(bool)), this, SLOT(slotMuteStateChanged(bool)) );
m_volumeMenu->addAction( sliderActionWidget );
muteBar->addAction( m_muteAction );
/* set icon and label to match create state of AudioOutput, as the
* desired volume value is not available yet (because the player
* object is not set up yet.) Someone must call PlayerManager::setVolume()
* later.
*/
slotVolumeChanged( 1.0 );
// let player notify us when volume changes
connect( player, SIGNAL(volumeChanged(float)), this, SLOT(slotVolumeChanged(float)) );
}
示例5: PopupWidget
LongMessageWidget::LongMessageWidget( QWidget *anchor, const QString &message,
Amarok::Logger::MessageType type )
: PopupWidget( anchor )
, m_counter( 0 )
, m_timeout( 6000 )
{
DEBUG_BLOCK
Q_UNUSED( type )
setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
setContentsMargins( 4, 4, 4, 4 );
setMinimumWidth( 26 );
setMinimumHeight( 26 );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
QPalette p = QToolTip::palette();
setPalette( p );
KHBox *hbox = new KHBox( this );
layout()->addWidget( hbox );
hbox->setSpacing( 12 );
m_countdownFrame = new CountdownFrame( hbox );
m_countdownFrame->setObjectName( "counterVisual" );
m_countdownFrame->setFixedWidth( fontMetrics().width( "X" ) );
m_countdownFrame->setFrameStyle( QFrame::Plain | QFrame::Box );
QPalette pal;
pal.setColor( m_countdownFrame->foregroundRole(), p.dark().color() );
m_countdownFrame->setPalette( pal );
QLabel *alabel = new QLabel( message, hbox );
alabel->setWordWrap( true );
alabel->setOpenExternalLinks( true );
alabel->setObjectName( "label" );
alabel->setTextFormat( Qt::RichText );
alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
alabel->setPalette( p );
hbox = new KHBox( this );
layout()->addWidget( hbox );
KPushButton *button = new KPushButton( KStandardGuiItem::close(), hbox );
button->setObjectName( "closeButton" );
connect( button, SIGNAL( clicked() ), SLOT( close() ) );
reposition();
show();
m_timerId = startTimer( m_timeout / m_countdownFrame->height() );
}
示例6: KPWizardPage
PreProcessingPage::PreProcessingPage(Manager* const mngr, KAssistantDialog* const dlg)
: KPWizardPage(dlg, i18n("<b>Pre-Processing Bracketed Images</b>")),
d(new PreProcessingPagePriv)
{
d->mngr = mngr;
d->progressTimer = new QTimer(this);
KVBox *vbox = new KVBox(this);
d->title = new QLabel(vbox);
d->title->setWordWrap(true);
d->title->setOpenExternalLinks(true);
d->alignCheckBox = new QCheckBox(i18n("Align bracketed images"), vbox);
KConfig config("kipirc");
KConfigGroup group = config.group(QString("ExpoBlending Settings"));
d->alignCheckBox->setChecked(group.readEntry("Auto Alignment", true));
QLabel* space1 = new QLabel(vbox);
KHBox* hbox = new KHBox(vbox);
d->detailsBtn = new QPushButton(hbox);
d->detailsBtn->setText(i18n("Details..."));
d->detailsBtn->hide();
QLabel* space2 = new QLabel(hbox);
hbox->setStretchFactor(space2, 10);
QLabel* space3 = new QLabel(vbox);
d->progressLabel = new QLabel(vbox);
d->progressLabel->setAlignment(Qt::AlignCenter);
QLabel* space4 = new QLabel(vbox);
vbox->setStretchFactor(space1, 2);
vbox->setStretchFactor(space3, 2);
vbox->setStretchFactor(space4, 10);
vbox->setSpacing(KDialog::spacingHint());
vbox->setMargin(KDialog::spacingHint());
setPageWidget(vbox);
resetTitle();
QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_expoblending/pics/assistant-preprocessing.png");
setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));
connect(d->mngr->thread(), SIGNAL(starting(KIPIExpoBlendingPlugin::ActionData)),
this, SLOT(slotAction(KIPIExpoBlendingPlugin::ActionData)));
connect(d->progressTimer, SIGNAL(timeout()),
this, SLOT(slotProgressTimerDone()));
connect(d->detailsBtn, SIGNAL(clicked()),
this, SLOT(slotShowDetails()));
}
示例7: KVBox
void KasPrefsDialog::addThumbsPage()
{
KVBox *thumbsPage = new KVBox( this );
KPageWidgetItem *item = addPage( thumbsPage, i18n("Thumbnails") );
item->setIcon( Icon( "icons" ) );
thumbsCheck = new QCheckBox( i18n("Enable thu&mbnails"), thumbsPage );
thumbsCheck->setWhatsThis(
i18n( "Enables the display of a thumbnailed image of the window when "
"you move your mouse pointer over an item. The thumbnails are "
"approximate, and may not reflect the current window contents.\n\n"
"Using this option on a slow machine may cause performance problems." ) );
thumbsCheck->setChecked( kasbar->thumbnailsEnabled() );
connect( thumbsCheck, SIGNAL( toggled(bool) ), kasbar, SLOT( setThumbnailsEnabled(bool) ) );
embedThumbsCheck = new QCheckBox( i18n("&Embed thumbnails"), thumbsPage );
embedThumbsCheck->setChecked( kasbar->embedThumbnails() );
connect( embedThumbsCheck, SIGNAL( toggled(bool) ), kasbar, SLOT( setEmbedThumbnails(bool) ) );
KHBox *thumbSizeBox = new KHBox( thumbsPage );
thumbSizeBox->setWhatsThis(
i18n( "Controls the size of the window thumbnails. Using large sizes may "
"cause performance problems." ) );
QLabel *thumbSizeLabel = new QLabel( i18n("Thumbnail &size: "), thumbSizeBox );
int percent = (int) (kasbar->thumbnailSize() * 100.0);
thumbSizeSlider = new QSlider( 0, 100, 1, percent, Qt::Horizontal, thumbSizeBox );
connect( thumbSizeSlider, SIGNAL( valueChanged( int ) ),
kasbar, SLOT( setThumbnailSize( int ) ) );
thumbSizeLabel->setBuddy( thumbSizeSlider );
KHBox *thumbUpdateBox = new KHBox( thumbsPage );
thumbUpdateBox->setSpacing( spacingHint() );
thumbUpdateBox->setWhatsThis(
i18n( "Controls the frequency with which the thumbnail of the active window "
"is updated. If the value is 0 then no updates will be performed.\n\n"
"Using small values may cause performance problems on slow machines." ) );
QLabel *thumbUpdateLabel = new QLabel( i18n("&Update thumbnail every: "), thumbUpdateBox );
thumbUpdateSpin = new QSpinBox( 0, 1000, 1, thumbUpdateBox );
thumbUpdateSpin->setValue( kasbar->thumbnailUpdateDelay() );
connect( thumbUpdateSpin, SIGNAL( valueChanged( int ) ),
kasbar, SLOT( setThumbnailUpdateDelay( int ) ) );
(void) new QLabel( i18n("seconds"), thumbUpdateBox );
thumbUpdateLabel->setBuddy( thumbUpdateSpin );
(void) new QWidget( thumbsPage, "spacer" );
(void) new QWidget( thumbsPage, "spacer" );
(void) new QWidget( thumbsPage, "spacer" );
}
示例8: KVBox
Playlist::Widget::Widget( QWidget* parent )
: KVBox( parent )
{
setContentsMargins( 1, 1, 1, 1 );
m_searchWidget = new ProgressiveSearchWidget( this );
//this is really only useful for debugging at the moment, so dont show it to users and testers
/*m_sortBox = new QComboBox( this );
m_sortBox->insertItem( 0, "Album", Album);
m_sortBox->insertItem( 1, "AlbumArtist", Album);
m_sortBox->insertItem( 2, "Artist", Artist );
m_sortBox->insertItem( 3, "Bitrate", Bitrate );
m_sortBox->insertItem( 4, "Bpm", Bpm );
m_sortBox->insertItem( 5, "Comment", Comment );
m_sortBox->insertItem( 6, "Composer", Composer );
m_sortBox->insertItem( 7, "Directory", Directory );
m_sortBox->insertItem( 8, "DiscNumber", DiscNumber );
m_sortBox->insertItem( 9, "Filename", Filename );
m_sortBox->insertItem( 10, "Filesize", Filesize );
m_sortBox->insertItem( 11, "Genre", Genre );
m_sortBox->insertItem( 12, "LastPlayed", LastPlayed );
m_sortBox->insertItem( 13, "Length", Length );
m_sortBox->insertItem( 14, "Mood", Mood );
m_sortBox->insertItem( 15, "PlayCount", PlayCount );
m_sortBox->insertItem( 16, "Rating", Rating );
m_sortBox->insertItem( 17, "SampleRate", SampleRate );
m_sortBox->insertItem( 18, "Score", Score );
m_sortBox->insertItem( 29, "Source", Source );
m_sortBox->insertItem( 30, "Title", Title );
m_sortBox->insertItem( 31, "TrackNumber", TrackNumber );
m_sortBox->insertItem( 32, "Type", Type );
m_sortBox->insertItem( 33, "Year", Year );
connect( m_sortBox, SIGNAL( activated( int ) ), this, SLOT( sort( int ) ) );*/
QWidget * layoutHolder = new QWidget( this );
QVBoxLayout* mainPlaylistlayout = new QVBoxLayout( layoutHolder );
mainPlaylistlayout->setContentsMargins( 0, 0, 0, 0 );
m_playlistView = new PrettyListView( this );
m_playlistView->show();
connect( m_searchWidget, SIGNAL( filterChanged( const QString &, int, bool ) ), m_playlistView, SLOT( find( const QString &, int, bool ) ) );
connect( m_searchWidget, SIGNAL( next( const QString &, int ) ), m_playlistView, SLOT( findNext( const QString &, int ) ) );
connect( m_searchWidget, SIGNAL( previous( const QString &, int ) ), m_playlistView, SLOT( findPrevious( const QString &, int ) ) );
connect( m_searchWidget, SIGNAL( filterCleared() ), m_playlistView, SLOT( clearSearchTerm() ) );
connect( m_searchWidget, SIGNAL( showOnlyMatches( bool ) ), m_playlistView, SLOT( showOnlyMatches( bool ) ) );
connect( m_searchWidget, SIGNAL( activateFilterResult() ), m_playlistView, SLOT( playFirstSelected() ) );
connect( m_searchWidget, SIGNAL( downPressed() ), m_playlistView, SLOT( setFocus() ) );
connect( m_playlistView, SIGNAL( found() ), m_searchWidget, SLOT( match() ) );
connect( m_playlistView, SIGNAL( notFound() ), m_searchWidget, SLOT( noMatch() ) );
connect( LayoutManager::instance(), SIGNAL( activeLayoutChanged() ), m_playlistView, SLOT( reset() ) );
mainPlaylistlayout->setSpacing( 0 );
mainPlaylistlayout->addWidget( m_playlistView );
KHBox *barBox = new KHBox( this );
barBox->setMargin( 0 );
KToolBar *plBar = new Amarok::ToolBar( barBox );
plBar->setObjectName( "PlaylistToolBar" );
Model::instance();
// the Controller ctor creates the undo/redo actions that we use below, so we want
// to make sure that it's been constructed and the the actions registered
Controller::instance();
{
//START Playlist toolbar
plBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred );
plBar->setIconDimensions( 22 );
plBar->setMovable( false );
plBar->addAction( new KToolBarSpacerAction( this ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_clear" ) );
//FIXME this action should go in ActionController, but we don't have any visibility to the view
KAction *action = new KAction( KIcon( "music-amarok" ), i18n("Show active track"), this );
connect( action, SIGNAL( triggered( bool ) ), m_playlistView, SLOT( scrollToActiveTrack() ) );
plBar->addAction( action );
plBar->addSeparator();
plBar->addAction( Amarok::actionCollection()->action( "playlist_undo" ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_redo" ) );
plBar->addSeparator();
plBar->addAction( Amarok::actionCollection()->action( "playlist_save" ) );
plBar->addAction( Amarok::actionCollection()->action( "playlist_export" ) );
plBar->addSeparator();
Playlist::LayoutConfigAction *layoutConfigAction = new Playlist::LayoutConfigAction( this );
plBar->addAction( layoutConfigAction );
QToolButton *tbutton = qobject_cast<QToolButton*>(plBar->widgetForAction( layoutConfigAction ) );
if( tbutton )
tbutton->setPopupMode( QToolButton::InstantPopup );
//.........这里部分代码省略.........
示例9: KDialog
AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName,
const PlaylistSearch &defaultSearch,
QWidget *parent,
const char *name) :
KDialog(parent)
{
setCaption( i18n("Create Search Playlist") );
setButtons( Ok|Cancel );
setDefaultButton( Ok );
setObjectName( QLatin1String( name ) );
setModal(true);
KVBox *mw = new KVBox(this);
setMainWidget(mw);
KHBox *box = new KHBox(mw);
box->setSpacing(5);
new QLabel(i18n("Playlist name:"), box);
m_playlistNameLineEdit = new KLineEdit(defaultName, box);
QGroupBox *criteriaGroupBox = new QGroupBox(i18n("Search Criteria"), mw);
mw->setStretchFactor(criteriaGroupBox, 1);
m_criteriaLayout = new QVBoxLayout;
QGroupBox *group = new QGroupBox();
m_matchAnyButton = new QRadioButton(i18n("Match any of the following"));
m_matchAllButton = new QRadioButton(i18n("Match all of the following"));
QHBoxLayout *hgroupbox = new QHBoxLayout;
hgroupbox->addWidget(m_matchAnyButton);
hgroupbox->addWidget(m_matchAllButton);
group->setLayout(hgroupbox);
m_criteriaLayout->addWidget(group);
if(defaultSearch.isNull()) {
SearchLine *newSearchLine = new SearchLine(this);
m_searchLines.append(newSearchLine);
m_criteriaLayout->addWidget(newSearchLine);
newSearchLine = new SearchLine(this);
m_searchLines.append(newSearchLine);
m_criteriaLayout->addWidget(newSearchLine);
m_matchAnyButton->setChecked(true);
}
else {
PlaylistSearch::ComponentList components = defaultSearch.components();
for(PlaylistSearch::ComponentList::ConstIterator it = components.constBegin();
it != components.constEnd();
++it)
{
SearchLine *s = new SearchLine(this);
s->setSearchComponent(*it);
m_searchLines.append(s);
m_criteriaLayout->addWidget(s);
}
if(defaultSearch.searchMode() == PlaylistSearch::MatchAny)
m_matchAnyButton->setChecked(true);
else
m_matchAllButton->setChecked(true);
}
QWidget *buttons = new QWidget(mw);
QHBoxLayout *l = new QHBoxLayout(buttons);
l->setSpacing(5);
l->setMargin(0);
KPushButton *clearButton = new KPushButton(KStandardGuiItem::clear(), buttons);
connect(clearButton, SIGNAL(clicked()), SLOT(clear()));
l->addWidget(clearButton);
l->addStretch(1);
m_moreButton = new KPushButton(i18nc("additional search options", "More"), buttons);
connect(m_moreButton, SIGNAL(clicked()), SLOT(more()));
l->addWidget(m_moreButton);
m_fewerButton = new KPushButton(i18n("Fewer"), buttons);
connect(m_fewerButton, SIGNAL(clicked()), SLOT(fewer()));
l->addWidget(m_fewerButton);
m_criteriaLayout->addStretch(1);
criteriaGroupBox->setLayout(m_criteriaLayout);
m_playlistNameLineEdit->setFocus();
}
示例10: QVBoxLayout
KComboBoxTest::KComboBoxTest(QWidget* widget)
:QWidget(widget)
{
QVBoxLayout *vbox = new QVBoxLayout (this);
// Qt combobox
KHBox* hbox = new KHBox(this);
hbox->setSpacing (-1);
QLabel* lbl = new QLabel("&QCombobox:", hbox);
lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
m_qc = new QComboBox(hbox);
m_qc->setObjectName( QLatin1String( "QtReadOnlyCombo" ) );
lbl->setBuddy (m_qc);
connectComboSignals(m_qc);
vbox->addWidget (hbox);
// Read-only combobox
hbox = new KHBox(this);
hbox->setSpacing (-1);
lbl = new QLabel("&Read-Only Combo:", hbox);
lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
m_ro = new KComboBox(hbox );
m_ro->setObjectName( "ReadOnlyCombo" );
lbl->setBuddy (m_ro);
m_ro->setCompletionMode( KGlobalSettings::CompletionAuto );
connectComboSignals(m_ro);
vbox->addWidget (hbox);
// Read-write combobox
hbox = new KHBox(this);
hbox->setSpacing (-1);
lbl = new QLabel("&Editable Combo:", hbox);
lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
m_rw = new KComboBox( true, hbox );
m_rw->setObjectName( "ReadWriteCombo" );
lbl->setBuddy (m_rw);
m_rw->setDuplicatesEnabled( true );
m_rw->setInsertPolicy( QComboBox::NoInsert );
m_rw->setTrapReturnKey( true );
connectComboSignals(m_rw);
vbox->addWidget (hbox);
// History combobox...
hbox = new KHBox(this);
hbox->setSpacing (-1);
lbl = new QLabel("&History Combo:", hbox);
lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
m_hc = new KHistoryComboBox( hbox );
m_hc->setObjectName( "HistoryCombo" );
lbl->setBuddy (m_hc);
m_hc->setDuplicatesEnabled( true );
m_hc->setInsertPolicy( QComboBox::NoInsert );
connectComboSignals(m_hc);
vbox->addWidget (hbox);
m_hc->setTrapReturnKey(true);
// Read-write combobox that is a replica of code in konqueror...
hbox = new KHBox(this);
hbox->setSpacing (-1);
lbl = new QLabel( "&Konq's Combo:", hbox);
lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
m_konqc = new KComboBox( true, hbox );
m_konqc->setObjectName( "KonqyCombo" );
lbl->setBuddy (m_konqc);
m_konqc->setMaxCount( 10 );
connectComboSignals(m_konqc);
vbox->addWidget (hbox);
// Create an exit button
hbox = new KHBox (this);
m_btnExit = new QPushButton( "E&xit", hbox );
QObject::connect( m_btnExit, SIGNAL(clicked()), SLOT(quitApp()) );
// Create a disable button...
m_btnEnable = new QPushButton( "Disa&ble", hbox );
QObject::connect (m_btnEnable, SIGNAL(clicked()), SLOT(slotDisable()));
vbox->addWidget (hbox);
// Popuplate the select-only list box
QStringList list;
list << "Stone" << "Tree" << "Peables" << "Ocean" << "Sand" << "Chips"
<< "Computer" << "Mankind";
list.sort();
// Setup the qcombobox
m_qc->addItems(list );
// Setup read-only combo
m_ro->addItems( list );
m_ro->completionObject()->setItems( list );
// Setup read-write combo
m_rw->addItems( list );
m_rw->completionObject()->setItems( list );
//.........这里部分代码省略.........
示例11: KDialog
SelectAuthorsDialog::SelectAuthorsDialog( QWidget *parent, const ElementList ¤tAuthors, RecipeDB *db )
: KDialog(parent ),
database(db)
{
setCaption(i18nc("@title:window", "Authors" ));
setButtons(KDialog::Ok | KDialog::Cancel);
setDefaultButton(KDialog::Ok);
setModal( true );
KVBox *page = new KVBox( this );
setMainWidget( page );
//Design UI
// Combo to Pick authors
KHBox *topBox = new KHBox(page);
topBox->setSpacing(6);
authorsCombo = new KComboBox( true, topBox );
authorsCombo->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
authorsCombo->completionObject() ->setCompletionMode( KGlobalSettings::CompletionPopupAuto );
authorsCombo->lineEdit() ->disconnect( authorsCombo ); //so hitting enter doesn't enter the item into the box
connect( authorsCombo->lineEdit(), SIGNAL( returnPressed() ),
this, SLOT( addAuthor() ) );
// Add/Remove buttons
addAuthorButton = new KPushButton( topBox );
addAuthorButton->setIcon( KIcon( "list-add" ) );
removeAuthorButton = new KPushButton( topBox );
removeAuthorButton->setIcon( KIcon( "list-remove" ) );
// Author List
authorListModel = new QStandardItemModel( 0, 2, this );
authorListView = new QTreeView( page );
authorListView->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
authorListView->setAllColumnsShowFocus( true );
authorListView->setRootIsDecorated( false );
QStringList horizontalLabels;
horizontalLabels << i18nc( "@title:column", "Id" ) << i18nc( "@title:column", "Author" );
authorListModel->setHorizontalHeaderLabels( horizontalLabels );
authorListProxyModel = new QSortFilterProxyModel(this);
authorListProxyModel->setSourceModel(authorListModel);
authorListProxyModel->setDynamicSortFilter( true );
authorListView->setModel( authorListProxyModel );
KConfigGroup config( KGlobal::config(), "Advanced" );
if ( !config.readEntry( "ShowID", false ) ) {
authorListView->hideColumn( 0 );
authorListView->header()->hide();
}
// Load the list
loadAuthors( currentAuthors );
adjustSize();
resize(450, height());
// Connect signals & Slots
connect ( addAuthorButton, SIGNAL( clicked() ), this, SLOT( addAuthor() ) );
connect ( removeAuthorButton, SIGNAL( clicked() ), this, SLOT( removeAuthor() ) );
authorsCombo->setEditText(QString());
authorsCombo->lineEdit()->setFocus();
}
示例12: KDialog
AddressEditDialog::AddressEditDialog( QWidget *parent )
: KDialog(parent)
{
setCaption( i18nc( "street/postal", "Edit Address" ) );
setButtons( Ok | Cancel );
setDefaultButton( Ok );
showButtonSeparator( true );
QWidget *page = new QWidget( this );
setMainWidget( page );
QGridLayout *topLayout = new QGridLayout( page );
topLayout->setSpacing( spacingHint() );
topLayout->setMargin( 0 );
mTypeCombo = new AddressTypeCombo( page );
topLayout->addWidget( mTypeCombo, 0, 0, 1, 2 );
QLabel *label = new QLabel( i18nc( "<streetLabel>:", "%1:", KABC::Address::streetLabel() ), page );
label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
topLayout->addWidget( label, 1, 0 );
mStreetTextEdit = new KTextEdit( page );
mStreetTextEdit->setAcceptRichText( false );
label->setBuddy( mStreetTextEdit );
topLayout->addWidget( mStreetTextEdit, 1, 1 );
TabPressEater *eater = new TabPressEater( this );
mStreetTextEdit->installEventFilter( eater );
label = new QLabel( i18nc( "<postOfficeBoxLabel>:", "%1:", KABC::Address::postOfficeBoxLabel() ), page );
topLayout->addWidget( label, 2 , 0 );
mPOBoxEdit = new KLineEdit( page );
label->setBuddy( mPOBoxEdit );
topLayout->addWidget( mPOBoxEdit, 2, 1 );
label = new QLabel( i18nc( "<localityLabel>:", "%1:", KABC::Address::localityLabel() ), page );
topLayout->addWidget( label, 3, 0 );
mLocalityEdit = new KLineEdit( page );
label->setBuddy( mLocalityEdit );
topLayout->addWidget( mLocalityEdit, 3, 1 );
label = new QLabel( i18nc( "<regionLabel>:", "%1:", KABC::Address::regionLabel() ), page );
topLayout->addWidget( label, 4, 0 );
mRegionEdit = new KLineEdit( page );
label->setBuddy( mRegionEdit );
topLayout->addWidget( mRegionEdit, 4, 1 );
label = new QLabel( i18nc( "<postalCodeLabel>:", "%1:", KABC::Address::postalCodeLabel() ), page );
topLayout->addWidget( label, 5, 0 );
mPostalCodeEdit = new KLineEdit( page );
label->setBuddy( mPostalCodeEdit );
topLayout->addWidget( mPostalCodeEdit, 5, 1 );
label = new QLabel( i18nc( "<countryLabel>:", "%1:", KABC::Address::countryLabel() ), page );
topLayout->addWidget( label, 6, 0 );
mCountryCombo = new KComboBox( page );
mCountryCombo->setEditable( true );
mCountryCombo->setDuplicatesEnabled( false );
QPushButton *labelButton = new QPushButton( i18n( "Edit Label..." ), page );
topLayout->addWidget( labelButton, 7, 0, 1, 2 );
connect( labelButton, SIGNAL(clicked()), SLOT(editLabel()) );
fillCountryCombo();
label->setBuddy( mCountryCombo );
topLayout->addWidget( mCountryCombo, 6, 1 );
mPreferredCheckBox = new QCheckBox( i18nc( "street/postal", "This is the preferred address" ), page );
topLayout->addWidget( mPreferredCheckBox, 8, 0, 1, 2 );
KSeparator *sep = new KSeparator( Qt::Horizontal, page );
topLayout->addWidget( sep, 9, 0, 1, 2 );
KHBox *buttonBox = new KHBox( page );
buttonBox->setSpacing( spacingHint() );
topLayout->addWidget( buttonBox, 10, 0, 1, 2 );
KAcceleratorManager::manage( this );
}
示例13: QWidget
FontColourChooser::FontColourChooser(QWidget *parent,
const QStringList &fontList, const QString& frameLabel, bool fg, bool defaultFont, int visibleListSize)
: QWidget(parent),
mFgColourButton(0),
mReadOnly(false)
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
topLayout->setSpacing(KDialog::spacingHint());
QWidget* page = this;
if (!frameLabel.isNull())
{
page = new QGroupBox(frameLabel, this);
topLayout->addWidget(page);
topLayout = new QVBoxLayout(page);
topLayout->setMargin(KDialog::marginHint());
topLayout->setSpacing(KDialog::spacingHint());
}
QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->setMargin(0);
topLayout->addLayout(hlayout);
QVBoxLayout* colourLayout = new QVBoxLayout();
colourLayout->setMargin(0);
hlayout->addLayout(colourLayout);
if (fg)
{
KHBox* box = new KHBox(page); // to group widgets for QWhatsThis text
box->setMargin(0);
box->setSpacing(KDialog::spacingHint()/2);
colourLayout->addWidget(box);
QLabel* label = new QLabel(i18nc("@label:listbox", "Foreground color:"), box);
box->setStretchFactor(new QWidget(box), 0);
mFgColourButton = new ColourButton(box);
connect(mFgColourButton, SIGNAL(changed(const QColor&)), SLOT(setSampleColour()));
label->setBuddy(mFgColourButton);
box->setWhatsThis(i18nc("@info:whatsthis", "Select the alarm message foreground color"));
}
KHBox* box = new KHBox(page); // to group widgets for QWhatsThis text
box->setMargin(0);
box->setSpacing(KDialog::spacingHint()/2);
colourLayout->addWidget(box);
QLabel* label = new QLabel(i18nc("@label:listbox", "Background color:"), box);
box->setStretchFactor(new QWidget(box), 0);
mBgColourButton = new ColourButton(box);
connect(mBgColourButton, SIGNAL(changed(const QColor&)), SLOT(setSampleColour()));
label->setBuddy(mBgColourButton);
box->setWhatsThis(i18nc("@info:whatsthis", "Select the alarm message background color"));
hlayout->addStretch();
if (defaultFont)
{
QHBoxLayout* layout = new QHBoxLayout();
layout->setMargin(0);
topLayout->addLayout(layout);
mDefaultFont = new CheckBox(i18nc("@option:check", "Use default font"), page);
mDefaultFont->setMinimumSize(mDefaultFont->sizeHint());
connect(mDefaultFont, SIGNAL(toggled(bool)), SLOT(slotDefaultFontToggled(bool)));
mDefaultFont->setWhatsThis(i18nc("@info:whatsthis", "Check to use the default font current at the time the alarm is displayed."));
layout->addWidget(mDefaultFont);
layout->addWidget(new QWidget(page)); // left adjust the widget
}
else
mDefaultFont = 0;
mFontChooser = new KFontChooser(page, KFontChooser::DisplayFrame, fontList, visibleListSize);
mFontChooser->installEventFilter(this); // for read-only mode
QList<QWidget*> kids = mFontChooser->findChildren<QWidget*>();
for (int i = 0, end = kids.count(); i < end; ++i)
kids[i]->installEventFilter(this);
topLayout->addWidget(mFontChooser);
slotDefaultFontToggled(false);
}
示例14: KVBox
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);
}
示例15: QWidget
DynamicCategory::DynamicCategory( QWidget* parent )
: QWidget( parent )
, m_biasListView( 0 )
, m_biasModel( 0 )
, m_biasDelegate( 0 )
{
bool enabled = AmarokConfig::dynamicMode();
setContentsMargins(0,0,0,0);
m_vLayout = new QVBoxLayout( this );
m_onOffCheckbox = new QCheckBox( this );
m_onOffCheckbox->setIcon( KIcon( "dynamic-amarok" ) );
m_onOffCheckbox->setText( i18n( "On" ) );
m_onOffCheckbox->setToolTip( i18n( "Turn dynamic mode on." ) );
m_onOffCheckbox->setCheckable( true );
m_onOffCheckbox->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
QObject::connect( m_onOffCheckbox, SIGNAL( toggled( bool ) ), this, SLOT( OnOff ( bool ) ) );
QObject::connect( (const QObject*)Amarok::actionCollection()->action( "playlist_clear" ), SIGNAL( triggered( bool ) ), this, SLOT( playlistCleared() ) );
m_repopulateButton = new QPushButton( this );
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() ) );
KHBox* presetLayout = new KHBox( this );
QLabel* presetLabel = new QLabel( i18n( "Playlist:" ), presetLayout );
m_presetComboBox = new KComboBox( presetLayout );
m_presetComboBox->setPalette( QApplication::palette() );
DynamicModel::instance()->loadPlaylists();
m_presetComboBox->setModel( DynamicModel::instance() );
connect( DynamicModel::instance(), SIGNAL( changeActive( int ) ),
m_presetComboBox, SLOT(setCurrentIndex(int)) );
connect( DynamicModel::instance(), SIGNAL( enableDynamicMode( bool ) ),
SLOT(enableDynamicMode(bool)) );
connect( m_presetComboBox, SIGNAL(currentIndexChanged( int ) ),
this, SLOT(playlistSelectionChanged( int ) ) );
presetLabel->setBuddy( m_presetComboBox );
presetLayout->setStretchFactor( m_presetComboBox, 1 );
KToolBar* presetToolbar = new KToolBar( presetLayout );
presetToolbar->setToolButtonStyle( Qt::ToolButtonIconOnly );
presetToolbar->setMovable( false );
presetToolbar->setFloatable( false );
presetToolbar->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
m_saveButton = new QToolButton( presetToolbar );
//m_saveButton->setText( i18n("Save") );
m_saveButton->setIcon( KIcon( "document-save-amarok" ) );
m_saveButton->setToolTip( i18n( "Save the preset." ) );
presetToolbar->addWidget( m_saveButton );
connect( m_saveButton, SIGNAL( clicked( bool ) ), SLOT( save() ) );
m_deleteButton = new QToolButton( presetToolbar );
//m_deleteButton->setText( i18n("Delete") );
m_deleteButton->setEnabled( false );
m_deleteButton->setIcon( KIcon( "edit-delete-amarok" ) );
m_deleteButton->setToolTip( i18n( "Delete the preset.") );
presetToolbar->addWidget( m_deleteButton );
connect( m_deleteButton, SIGNAL(clicked(bool)),
DynamicModel::instance(), SLOT(removeActive()) );
m_biasListView = new QListView( this );
m_biasListView->setFrameShape( QFrame::NoFrame );
m_biasListView->setAlternatingRowColors( true );
The::paletteHandler()->updateItemView( m_biasListView );
connect( The::paletteHandler(), SIGNAL( newPalette( const QPalette & ) ), SLOT( newPalette( const QPalette & ) ) );
m_biasModel = new DynamicBiasModel( m_biasListView );
m_biasListView->setModel( m_biasModel );
connect( m_biasModel, SIGNAL(playlistModified(Dynamic::BiasedPlaylistPtr)),
DynamicModel::instance(), SLOT(playlistModified(Dynamic::BiasedPlaylistPtr)) );
m_biasDelegate = new DynamicBiasDelegate( m_biasListView );
m_biasListView->setItemDelegate( m_biasDelegate );
m_vLayout->addWidget( m_onOffCheckbox );
//.........这里部分代码省略.........