本文整理汇总了C++中KHBox::setSpacing方法的典型用法代码示例。如果您正苦于以下问题:C++ KHBox::setSpacing方法的具体用法?C++ KHBox::setSpacing怎么用?C++ KHBox::setSpacing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KHBox
的用法示例。
在下文中一共展示了KHBox::setSpacing方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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)) );
}
示例3: 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() );
}
示例4: addThumbsPage
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" );
}
示例5: QLabel
StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_url(url),
m_homeUrl(0),
m_splitView(0),
m_editableUrl(0),
m_showFullPath(0),
m_filterBar(0)
{
const int spacing = KDialog::spacingHint();
QVBoxLayout* topLayout = new QVBoxLayout(this);
KVBox* vBox = new KVBox(this);
vBox->setSpacing(spacing);
// create 'Home URL' editor
QGroupBox* homeBox = new QGroupBox(i18nc("@title:group", "Home Folder"), vBox);
KHBox* homeUrlBox = new KHBox(homeBox);
homeUrlBox->setSpacing(spacing);
new QLabel(i18nc("@label:textbox", "Location:"), homeUrlBox);
m_homeUrl = new KLineEdit(homeUrlBox);
m_homeUrl->setClearButtonShown(true);
QPushButton* selectHomeUrlButton = new QPushButton(KIcon("folder-open"), QString(), homeUrlBox);
#ifndef QT_NO_ACCESSIBILITY
selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location"));
#endif
connect(selectHomeUrlButton, SIGNAL(clicked()),
this, SLOT(selectHomeUrl()));
KHBox* buttonBox = new KHBox(homeBox);
buttonBox->setSpacing(spacing);
QPushButton* useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"), buttonBox);
connect(useCurrentButton, SIGNAL(clicked()),
this, SLOT(useCurrentLocation()));
QPushButton* useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"), buttonBox);
connect(useDefaultButton, SIGNAL(clicked()),
this, SLOT(useDefaultLocation()));
QVBoxLayout* homeBoxLayout = new QVBoxLayout(homeBox);
homeBoxLayout->addWidget(homeUrlBox);
homeBoxLayout->addWidget(buttonBox);
// create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes
m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"), vBox);
m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"), vBox);
m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"), vBox);
m_filterBar = new QCheckBox(i18nc("@option:check Startup Settings", "Show filter bar"), vBox);
// Add a dummy widget with no restriction regarding
// a vertical resizing. This assures that the dialog layout
// is not stretched vertically.
new QWidget(vBox);
topLayout->addWidget(vBox);
loadSettings();
connect(m_homeUrl, SIGNAL(textChanged(QString)), this, SLOT(slotSettingsChanged()));
connect(m_splitView, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
connect(m_editableUrl, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
connect(m_showFullPath, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
connect(m_filterBar, SIGNAL(toggled(bool)), this, SLOT(slotSettingsChanged()));
}
示例6: setupGui
OcrEngine::EngineError KadmosDialog::setupGui()
{
OcrEngine::EngineError err = OcrBaseDialog::setupGui();
// setupPreprocessing( addVBoxPage( i18n("Preprocessing")));
// setupSegmentation( addVBoxPage( i18n("Segmentation")));
// setupClassification( addVBoxPage( i18n("Classification")));
/* continue page setup on the first page */
KVBox *page = new KVBox(this);
// FIXME: dynamic classifier reading.
new QLabel(i18n("Please classify the font type and language of the text on the image:"), page);
KHBox *locBox = new KHBox( page );
m_bbFont = new Q3ButtonGroup(1, Qt::Horizontal, i18n("Font Type Selection"), locBox);
m_rbMachine = new QRadioButton( i18n("Machine print"), m_bbFont );
m_rbHand = new QRadioButton( i18n("Hand writing"), m_bbFont );
m_rbNorm = new QRadioButton( i18n("Norm font"), m_bbFont );
m_gbLang = new Q3GroupBox(1, Qt::Horizontal, i18n("Country"), locBox);
m_cbLang = new QComboBox( m_gbLang );
m_cbLang->setItemText(m_cbLang->currentIndex(), KLocale::defaultCountry());
connect( m_bbFont, SIGNAL(clicked(int)), this, SLOT(slFontChanged(int) ));
m_rbMachine->setChecked(true);
/* --- */
KHBox *innerBox = new KHBox( page );
innerBox->setSpacing( KDialog::spacingHint());
Q3ButtonGroup *cbGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("OCR Modifier"), innerBox );
Q_CHECK_PTR(cbGroup);
m_cbNoise = new QCheckBox( i18n( "Enable automatic noise reduction" ), cbGroup );
m_cbAutoscale = new QCheckBox( i18n( "Enable automatic scaling"), cbGroup );
addExtraSetupWidget(page);
if( err != OcrEngine::ENG_OK )
{
enableFields(false);
enableButton(User1, false );
}
if( m_ttfClassifier.count() == 0 )
{
m_rbMachine->setEnabled(false);
}
if( m_handClassifier.count() == 0 )
{
m_rbHand->setEnabled(false);
}
if( !m_haveNorm )
m_rbNorm->setEnabled(false);
if( (m_ttfClassifier.count() + m_handClassifier.count()) == 0 && ! m_haveNorm )
{
KMessageBox::error(0, i18n("The classifier files for KADMOS could not be found.\n"
"OCR with KADMOS will not be possible.\n\n"
"Change the OCR engine in the preferences dialog."),
i18n("Installation Error") );
err = OcrEngine::ENG_BAD_SETUP;
}
else
slotFontChanged( 0 ); // Load machine print font language list
ocrShowInfo(QString::null);
return err;
}
示例7: QLabel
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();
}
示例8: historyConfig
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 );
//.........这里部分代码省略.........
示例9: config
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();
}
示例10: 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 );
}
示例11: 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);
}
示例12: generalConfig
//.........这里部分代码省略.........
QVBoxLayout *mTopLayout = new QVBoxLayout( topBox );
QLabel *label = new QLabel(
i18nc( "@label",
"Reminders: "
"Click on a title to toggle the details viewer for that item" ),
topBox );
mTopLayout->addWidget( label );
mIncidenceTree = new QTreeWidget( topBox );
mIncidenceTree->setColumnCount( 3 );
mIncidenceTree->setSortingEnabled( true );
const QStringList headerLabels =
( QStringList( i18nc( "@title:column reminder title", "Title" ) )
<< i18nc( "@title:column happens at date/time", "Date Time" )
<< i18nc( "@title:column trigger date/time", "Trigger Time" ) );
mIncidenceTree->setHeaderLabels( headerLabels );
mIncidenceTree->headerItem()->setToolTip(
0,
i18nc( "@info:tooltip", "The event or to-do title" ) );
mIncidenceTree->headerItem()->setToolTip(
1,
i18nc( "@info:tooltip", "The reminder is set for this date/time" ) );
mIncidenceTree->headerItem()->setToolTip(
2,
i18nc( "@info:tooltip", "The date/time the reminder was triggered" ) );
mIncidenceTree->setWordWrap( true );
mIncidenceTree->setAllColumnsShowFocus( true );
mIncidenceTree->setSelectionMode( QAbstractItemView::ExtendedSelection );
mIncidenceTree->setRootIsDecorated( false );
mTopLayout->addWidget( mIncidenceTree );
connect( mIncidenceTree, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
SLOT(update()) );
connect( mIncidenceTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
SLOT(update()) );
connect( mIncidenceTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
SLOT(toggleDetails(QTreeWidgetItem*,int)) );
connect( mIncidenceTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
SLOT(update()) );
connect( mIncidenceTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
SLOT(edit()) );
connect( mIncidenceTree, SIGNAL(itemSelectionChanged()),
SLOT(update()) );
mDetailView = new CalendarSupport::IncidenceViewer( mCalendar, topBox );
QString s;
s = i18nc( "@info default incidence details string",
"<emphasis>Select an event or to-do from the list above "
"to view its details here.</emphasis>" );
mDetailView->setDefaultMessage( s );
mTopLayout->addWidget( mDetailView );
mDetailView->hide();
mLastItem = 0;
KHBox *suspendBox = new KHBox( topBox );
suspendBox->setSpacing( spacingHint() );
mTopLayout->addWidget( suspendBox );
QLabel *l = new QLabel( i18nc( "@label:spinbox", "Suspend &duration:" ), suspendBox );
mSuspendSpin = new QSpinBox( suspendBox );
mSuspendSpin->setRange( 1, 9999 );
mSuspendSpin->setValue( defSuspendVal ); // default suspend duration
mSuspendSpin->setToolTip(
i18nc( "@info:tooltip",
"Suspend the reminders by this amount of time" ) );
mSuspendSpin->setWhatsThis(
i18nc( "@info:whatsthis",
"Each reminder for the selected incidences will be suspended "
"by this number of time units. You can choose the time units "
"(typically minutes) in the adjacent selector." ) );
l->setBuddy( mSuspendSpin );
mSuspendUnit = new KComboBox( suspendBox );
mSuspendUnit->addItem( i18nc( "@item:inlistbox suspend in terms of minutes", "minute(s)" ) );
mSuspendUnit->addItem( i18nc( "@item:inlistbox suspend in terms of hours", "hour(s)" ) );
mSuspendUnit->addItem( i18nc( "@item:inlistbox suspend in terms of days", "day(s)" ) );
mSuspendUnit->addItem( i18nc( "@item:inlistbox suspend in terms of weeks", "week(s)" ) );
mSuspendUnit->setToolTip(
i18nc( "@info:tooltip",
"Suspend the reminders using this time unit" ) );
mSuspendUnit->setWhatsThis(
i18nc( "@info:whatsthis",
"Each reminder for the selected incidences will be suspended "
"using this time unit. You can set the number of time units "
"in the adjacent number entry input." ) );
mSuspendUnit->setCurrentIndex( defSuspendUnit );
connect( &mSuspendTimer, SIGNAL(timeout()), SLOT(wakeUp()) );
connect( this, SIGNAL(okClicked()), this, SLOT(slotOk()) );
connect( this, SIGNAL(user1Clicked()), this, SLOT(slotUser1()) );
connect( this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()) );
connect( this, SIGNAL(user3Clicked()), this, SLOT(slotUser3()) );
}
示例13: 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);
}
示例14: init
void AlarmTimeWidget::init(Mode mode, const QString& title)
{
static const QString recurText = i18nc("@info/plain",
"If a recurrence is configured, the start date/time will be adjusted "
"to the first recurrence on or after the entered date/time.");
static const QString tzText = i18nc("@info/plain",
"This uses KAlarm's default time zone, set in the Configuration dialog.");
QWidget* topWidget;
if (title.isEmpty())
topWidget = this;
else
{
QBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setSpacing(0);
topWidget = new QGroupBox(title, this);
layout->addWidget(topWidget);
}
mDeferring = mode & DEFER_TIME;
mButtonGroup = new ButtonGroup(this);
connect(mButtonGroup, SIGNAL(buttonSet(QAbstractButton*)), SLOT(slotButtonSet(QAbstractButton*)));
QVBoxLayout* topLayout = new QVBoxLayout(topWidget);
topLayout->setSpacing(KDialog::spacingHint());
topLayout->setMargin(title.isEmpty() ? 0 : KDialog::marginHint());
// At time radio button/label
mAtTimeRadio = new RadioButton((mDeferring ? i18nc("@option:radio", "Defer to date/time:") : i18nc("@option:radio", "At date/time:")), topWidget);
mAtTimeRadio->setFixedSize(mAtTimeRadio->sizeHint());
mAtTimeRadio->setWhatsThis(mDeferring ? i18nc("@info:whatsthis", "Reschedule the alarm to the specified date and time.")
: i18nc("@info:whatsthis", "Specify the date, or date and time, to schedule the alarm."));
mButtonGroup->addButton(mAtTimeRadio);
// Date edit box
mDateEdit = new DateEdit(topWidget);
connect(mDateEdit, SIGNAL(dateEntered(const QDate&)), SLOT(dateTimeChanged()));
mDateEdit->setWhatsThis(i18nc("@info:whatsthis",
"<para>Enter the date to schedule the alarm.</para>"
"<para>%1</para>", (mDeferring ? tzText : recurText)));
mAtTimeRadio->setFocusWidget(mDateEdit);
// Time edit box and Any time checkbox
KHBox* timeBox = new KHBox(topWidget);
timeBox->setSpacing(2*KDialog::spacingHint());
mTimeEdit = new TimeEdit(timeBox);
mTimeEdit->setFixedSize(mTimeEdit->sizeHint());
connect(mTimeEdit, SIGNAL(valueChanged(int)), SLOT(dateTimeChanged()));
mTimeEdit->setWhatsThis(i18nc("@info:whatsthis",
"<para>Enter the time to schedule the alarm.</para>"
"<para>%1</para>"
"<para>%2</para>", (mDeferring ? tzText : recurText), TimeSpinBox::shiftWhatsThis()));
mAnyTime = -1; // current status is uninitialised
if (mode == DEFER_TIME)
{
mAnyTimeAllowed = false;
mAnyTimeCheckBox = 0;
}
else
{
mAnyTimeAllowed = true;
mAnyTimeCheckBox = new CheckBox(i18nc("@option:check", "Any time"), timeBox);
mAnyTimeCheckBox->setFixedSize(mAnyTimeCheckBox->sizeHint());
connect(mAnyTimeCheckBox, SIGNAL(toggled(bool)), SLOT(slotAnyTimeToggled(bool)));
mAnyTimeCheckBox->setWhatsThis(i18nc("@info:whatsthis",
"Check to specify only a date (without a time) for the alarm. The alarm will trigger at the first opportunity on the selected date."));
}
// 'Time from now' radio button/label
mAfterTimeRadio = new RadioButton((mDeferring ? i18nc("@option:radio", "Defer for time interval:") : i18nc("@option:radio", "Time from now:")), topWidget);
mAfterTimeRadio->setFixedSize(mAfterTimeRadio->sizeHint());
mAfterTimeRadio->setWhatsThis(mDeferring ? i18nc("@info:whatsthis", "Reschedule the alarm for the specified time interval after now.")
: i18nc("@info:whatsthis", "Schedule the alarm after the specified time interval from now."));
mButtonGroup->addButton(mAfterTimeRadio);
// Delay time spin box
mDelayTimeEdit = new TimeSpinBox(1, maxDelayTime, topWidget);
mDelayTimeEdit->setValue(1439);
mDelayTimeEdit->setFixedSize(mDelayTimeEdit->sizeHint());
connect(mDelayTimeEdit, SIGNAL(valueChanged(int)), SLOT(delayTimeChanged(int)));
mDelayTimeEdit->setWhatsThis(mDeferring ? i18nc("@info:whatsthis", "<para>%1</para><para>%2</para>", i18n_TimeAfterPeriod(), TimeSpinBox::shiftWhatsThis())
: i18nc("@info:whatsthis", "<para>%1</para><para>%2</para><para>%3</para>", i18n_TimeAfterPeriod(), recurText, TimeSpinBox::shiftWhatsThis()));
mAfterTimeRadio->setFocusWidget(mDelayTimeEdit);
// Set up the layout, either narrow or wide
QGridLayout* grid = new QGridLayout();
grid->setMargin(0);
topLayout->addLayout(grid);
if (mDeferring)
{
grid->addWidget(mAtTimeRadio, 0, 0);
grid->addWidget(mDateEdit, 0, 1, Qt::AlignLeft);
grid->addWidget(timeBox, 1, 1, Qt::AlignLeft);
grid->setColumnStretch(2, 1);
topLayout->addStretch();
QHBoxLayout* layout = new QHBoxLayout();
topLayout->addLayout(layout);
layout->addWidget(mAfterTimeRadio);
layout->addWidget(mDelayTimeEdit);
layout->addStretch();
//.........这里部分代码省略.........