本文整理汇总了C++中QVBox::setSpacing方法的典型用法代码示例。如果您正苦于以下问题:C++ QVBox::setSpacing方法的具体用法?C++ QVBox::setSpacing怎么用?C++ QVBox::setSpacing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVBox
的用法示例。
在下文中一共展示了QVBox::setSpacing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLabel
KServiceSelectDlg::KServiceSelectDlg(const QString & /*serviceType*/, const QString & /*value*/, QWidget *parent)
: KDialogBase(parent, "serviceSelectDlg", true, i18n("Add Service"), Ok | Cancel, Ok)
{
QVBox *vbox = new QVBox(this);
vbox->setSpacing(KDialog::spacingHint());
new QLabel(i18n("Select service:"), vbox);
m_listbox = new KListBox(vbox);
// Can't make a KTrader query since we don't have a servicetype to give,
// we want all services that are not applications.......
// So we have to do it the slow way
// ### Why can't we query for KParts/ReadOnlyPart as the servicetype? Should work fine!
KService::List allServices = KService::allServices();
QValueListIterator< KService::Ptr > it(allServices.begin());
for(; it != allServices.end(); ++it)
if((*it)->hasServiceType("KParts/ReadOnlyPart"))
{
m_listbox->insertItem(new KServiceListItem((*it), KServiceListWidget::SERVICELIST_SERVICES));
}
m_listbox->sort();
m_listbox->setMinimumHeight(350);
m_listbox->setMinimumWidth(300);
connect(m_listbox, SIGNAL(doubleClicked(QListBoxItem *)), SLOT(slotOk()));
setMainWidget(vbox);
}
示例2: setupGui
void ProgressDialog::setupGui(const QString& heading)
{
QVBox* vbox = makeVBoxMainWidget();
vbox->setSpacing(10);
QWidget* headingBox = new QWidget(vbox);
QHBoxLayout* hboxLayout = new QHBoxLayout(headingBox);
QLabel* textLabel = new QLabel(heading, headingBox);
textLabel->setMinimumWidth(textLabel->sizeHint().width());
textLabel->setFixedHeight(textLabel->sizeHint().height());
hboxLayout->addWidget(textLabel);
hboxLayout->addStretch();
d->gear = new KAnimWidget(QString("kde"), 32, headingBox);
d->gear->setFixedSize(32, 32);
hboxLayout->addWidget(d->gear);
d->resultbox = new QListBox(vbox);
d->resultbox->setSelectionMode(QListBox::NoSelection);
QFontMetrics fm(d->resultbox->fontMetrics());
d->resultbox->setMinimumSize(fm.width("0")*70, fm.lineSpacing()*8);
resize(sizeHint());
}
示例3: QDialog
OptionsDialog::OptionsDialog(QWidget *parent)
: QDialog(parent, 0, false, Qt::WDestructiveClose)
{
setCaption("QucsTranscalc "+tr("Options"));
// -------- create dialog widgets ------------
vLayout = new QVBoxLayout(this);
vLayout->setMargin(3);
vLayout->setSpacing(3);
QHGroupBox * h = new QHGroupBox(tr("Units"), this);
vLayout->addWidget(h);
QVBox * l = new QVBox(h);
l->setSpacing(3);
QLabel * lfr = new QLabel(tr("Frequency"),l);
lfr->setAlignment (Qt::AlignRight);
QLabel * lle = new QLabel(tr("Length"),l);
lle->setAlignment (Qt::AlignRight);
QLabel * lre = new QLabel(tr("Resistance"),l);
lre->setAlignment (Qt::AlignRight);
QLabel * lan = new QLabel(tr("Angle"),l);
lan->setAlignment (Qt::AlignRight);
QVBox * r = new QVBox(h);
r->setSpacing(3);
for (int j = 0; j < 4; j++) {
units[j] = new QComboBox(r);
for (int i = 0; TransUnits[j].units[i] != NULL; i++)
units[j]->insertItem (TransUnits[j].units[i]);
}
units[0]->setCurrentItem (QucsSettings.freq_unit);
units[1]->setCurrentItem (QucsSettings.length_unit);
units[2]->setCurrentItem (QucsSettings.res_unit);
units[3]->setCurrentItem (QucsSettings.ang_unit);
QHBox * h2 = new QHBox(this);
vLayout->addWidget(h2);
QPushButton *ButtonSave = new QPushButton(tr("Save as Default"), h2);
connect(ButtonSave, SIGNAL(clicked()), SLOT(slotSave()));
QPushButton *ButtonClose = new QPushButton(tr("Dismiss"), h2);
connect(ButtonClose, SIGNAL(clicked()), SLOT(slotClose()));
ButtonClose->setFocus();
}
示例4: KDialogBase
ConfigDlg::ConfigDlg(QWidget *parent, const char *name)
: KDialogBase(KDialogBase::TreeList, WStyle_DialogBorder, parent, name, true, "Settings", KDialogBase::Ok|KDialogBase::Cancel)
{
setShowIconsInTreeList(true);
setMinimumSize(600,400);
enableButtonSeparator(true);
unfoldTreeList();
QVBox *frame;
QStringList path;
path << i18n("Languages");
setFolderIcon(path, BarIcon("protoeditor", KIcon::SizeSmall));
QValueList<LanguageSettings*> llist = Protoeditor::self()->settings()->languageSettingsList();
QValueList<LanguageSettings*>::iterator it;
for(it = llist.begin(); it != llist.end(); ++it)
{
path.clear();
path << i18n("Languages") << (*it)->languageName();
frame = addVBoxPage(path, (*it)->languageName(), BarIcon((*it)->iconName(), KIcon::SizeSmall));
frame->setSpacing(0);
frame->setMargin(0);
m_langSettingsWidgets.append((*it)->createSettingsWidget(frame));
}
path.clear();
path << i18n("Sites");
frame= addVBoxPage(path, i18n("Sites"), BarIcon("package_network", KIcon::SizeSmall));
frame->setSpacing(0);
frame->setMargin(0);
m_siteSettingsWidget = new SiteSettingsWidget(frame);//->reparent(((QWidget*)frame), 0, QPoint());
path.clear();
path << i18n("External Applications");
frame = addVBoxPage(path, i18n("External Applications"), BarIcon("gear", KIcon::SizeSmall));
frame->setSpacing(0);
frame->setMargin(0);
m_extAppSettingsWidget = new ExtAppSettingsWidget(frame, i18n("External Applications"));//->reparent(((QWidget*)frame), 0, QPoint());
resize(QSize(590, 300).expandedTo(minimumSizeHint()));
}
示例5: QDialog
KReferDialog::KReferDialog( KPhoneView * phv,int kcwn,QString uPrefix,QWidget *parent, const char *name )
: QDialog( parent, name, true )
{
phoneView=phv;
kcwNumber= kcwn;
userPrefix=uPrefix;
phoneBook = 0;
QVBox *vbox = new QVBox( this );
vbox->setMargin( 3 );
vbox->setSpacing( 3 );
QVBoxLayout *vboxl = new QVBoxLayout( this, 5 );
vboxl->addWidget( vbox );
(void) new QLabel( tr("Refer-to URI:"), vbox );
touri = new QLineEdit( vbox );
touri->setMinimumWidth( fontMetrics().maxWidth() * 20 );
QHBoxLayout *buttonBox;
buttonBox = new QHBoxLayout( vboxl, 6 );
loadUri = new QPushButton( "", this );
QIconSet icon;
icon.setPixmap(SHARE_DIR "/icons/phonebook.png", QIconSet::Automatic );
loadUri->setIconSet( icon );
loadUri->setFixedWidth( loadUri->fontMetrics().maxWidth() * 2 );
buttonBox->addWidget( loadUri );
helpPushButton = new QPushButton( this, tr("help button") );
helpPushButton->setText( tr("&help...") );
helpPushButton->setEnabled( FALSE );
buttonBox->addWidget( helpPushButton );
QSpacerItem *spacer = new QSpacerItem(
0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
buttonBox->addItem( spacer );
okPushButton = new QPushButton( this, tr("ok button") );
okPushButton->setText( "OK" );
okPushButton->setDefault( TRUE );
buttonBox->addWidget( okPushButton );
cancelPushButton = new QPushButton( this,tr( "cancel button") );
cancelPushButton->setText( tr("Cancel") );
cancelPushButton->setAccel( Key_Escape );
buttonBox->addWidget( cancelPushButton );
connect( loadUri, SIGNAL( clicked() ),
this, SLOT( getUri() ) );
connect( okPushButton, SIGNAL( clicked() ),
this, SLOT( slotOk() ) );
connect( cancelPushButton, SIGNAL( clicked() ),
this, SLOT( slotCancel() ) );
}
示例6: cfg
NotesControl::NotesControl( QWidget *, const char * )
: QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop )
// : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
{
Config cfg("Notes");
cfg.setGroup("Options");
m_showMax = cfg.readBoolEntry("ShowMax", false);
setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
m_loaded = false;
m_edited = false;
QVBox *vbox = new QVBox( this, "Vlayout" );
QHBox *hbox = new QHBox( this, "HLayout" );
m_editArea = new QMultiLineEdit( vbox, "OpieNotesView" );
m_notesList = new QListBox( vbox, "OpieNotesBox" );
QPEApplication::setStylusOperation( m_notesList->viewport(), QPEApplication::RightOnHold );
m_notesList->setFixedHeight( 50 );
vbox->setMargin( 6 );
vbox->setSpacing( 3 );
setFocusPolicy(QWidget::StrongFocus);
newButton = new QPushButton( hbox, "newButton" );
newButton->setText(tr("New"));
saveButton = new QPushButton( hbox, "saveButton" );
saveButton->setText(tr("Save"));
deleteButton = new QPushButton( hbox, "deleteButton" );
deleteButton->setText(tr("Delete"));
connect( m_notesList, SIGNAL( mouseButtonPressed(int,QListBoxItem*,const QPoint&)),
this,SLOT( boxPressed(int,QListBoxItem*,const QPoint&)) );
connect( m_notesList, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString&)));
connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) );
connect( m_editArea,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) );
connect( newButton, SIGNAL(clicked()), this, SLOT(slotNewButton()) );
connect( saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton()) );
connect( deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButton()) );
m_selected = -1;
setCaption("Notes");
}
示例7: QVBox
QWidget * DataRecorderChannelBoolean::getPropertyWidget(QWidget * parent, const char * name)
{
if (!m_propertyWidget)
{
// Setup widget
QVBox * widget = new QVBox(parent,name);
Q_CHECK_PTR(widget);
widget->setMargin(KDialog::marginHint());
widget->setSpacing(KDialog::spacingHint());
QLabel * lab;
lab = new QLabel(i18n("DataRecorder", "Channel:"), widget);
Q_CHECK_PTR(lab);
KSimLineEdit * conName;
conName = new KSimLineEdit(widget);
Q_CHECK_PTR(conName);
conName->setText(getConnector()->getName());
connect(getConnector(), SIGNAL(signalSetName(const QString &)), conName, SLOT(setText(const QString &)));
connect(conName, SIGNAL(changed(const QString &)), SLOT(setChannelName(const QString &)));
lab->setBuddy(conName);
// TODO add ToolTip
ChannelPositionWidget * pos;
pos = new ChannelPositionWidget(this, widget);
Q_CHECK_PTR(pos);
pos->setGainValue(getVerticalGain());
pos->setOffsetValue(getVerticalOffset());
connect(pos, SIGNAL(gainChanged(double)), SLOT(setVerticalGain(double)));
connect(pos, SIGNAL(offsetChanged(double)), SLOT(setVerticalOffset(double)));
KColorButton * color = new KColorButton(widget);
Q_CHECK_PTR(color);
color->setColor(getLineColor());
connect(color, SIGNAL(changed(const QColor &)), SLOT(setLineColor(const QColor &)));
m_propertyWidget = widget;
}
else
{
if (parent)
{
KSIMDEBUG("Only one widget allowed");
}
}
return m_propertyWidget;
}
示例8: QWidget
Kfind::Kfind(QWidget *parent, const char *name) : QWidget(parent, name)
{
kdDebug() << "Kfind::Kfind " << this << endl;
QBoxLayout *mTopLayout = new QBoxLayout(this, QBoxLayout::LeftToRight, KDialog::marginHint(), KDialog::spacingHint());
// create tabwidget
tabWidget = new KfindTabWidget(this);
mTopLayout->addWidget(tabWidget);
/*
* This is ugly. Might be a KSeparator bug, but it makes a small black
* pixel for me which is visually distracting (GS).
// create separator
KSeparator * mActionSep = new KSeparator( this );
mActionSep->setFocusPolicy( QWidget::ClickFocus );
mActionSep->setOrientation( QFrame::VLine );
mTopLayout->addWidget(mActionSep);
*/
// create button box
QVBox *mButtonBox = new QVBox(this);
QVBoxLayout *lay = (QVBoxLayout *)mButtonBox->layout();
lay->addStretch(1);
mTopLayout->addWidget(mButtonBox);
mSearch = new KPushButton(KGuiItem(i18n("&Find"), "find"), mButtonBox);
mButtonBox->setSpacing((tabWidget->sizeHint().height() - 4 * mSearch->sizeHint().height()) / 4);
connect(mSearch, SIGNAL(clicked()), this, SLOT(startSearch()));
mStop = new KPushButton(KGuiItem(i18n("Stop"), "stop"), mButtonBox);
connect(mStop, SIGNAL(clicked()), this, SLOT(stopSearch()));
mSave = new KPushButton(KStdGuiItem::saveAs(), mButtonBox);
connect(mSave, SIGNAL(clicked()), this, SLOT(saveResults()));
KPushButton *mClose = new KPushButton(KStdGuiItem::close(), mButtonBox);
connect(mClose, SIGNAL(clicked()), this, SIGNAL(destroyMe()));
// react to search requests from widget
connect(tabWidget, SIGNAL(startSearch()), this, SLOT(startSearch()));
mSearch->setEnabled(true); // Enable "Search"
mStop->setEnabled(false); // Disable "Stop"
mSave->setEnabled(false); // Disable "Save..."
dirlister = new KDirLister();
}
示例9: showPopUp
/**
* @short Shows a popup
* @author Rene Schmidt <[email protected]>
* @version 0.1
*/
void KLAidWidget::showPopUp(QString &caption, QString &text, uint &tOut)
{
// Tell user when the next popup will be shown
QToolTip::add(tray, i18n("K Learning Aid %1").arg(VER) + "\nNext PopUp will be shown at " + aut->projectTime(aut->getInterval()));
// this is a candidate for subclassing... Copied in part from kpassivepopup.cpp (c) by KDE Team
KPassivePopup *pop = new KPassivePopup( tray );
pop->setPaletteForegroundColor(*tmpFgColor);
pop->setPaletteBackgroundColor(*tmpBgColor);
QVBox *vb = new QVBox( pop );
vb->setSpacing( KDialog::spacingHint() );
QHBox *hb=0;
hb = new QHBox(vb);
hb->setMargin(0);
hb->setSpacing(KDialog::spacingHint() );
QLabel *ttlIcon=0;
ttlIcon = new QLabel( hb, "title_icon" );
ttlIcon->setPixmap( SmallIcon("ktimer") );
ttlIcon->setAlignment( AlignLeft );
if ( !caption.isEmpty() ) {
QLabel *ttl=0;
ttl = new QLabel(caption, hb ? hb : vb, "title_label");
ttl->setFont( *fntCaption );
ttl->setAlignment( Qt::AlignHCenter );
if ( hb )
hb->setStretchFactor( ttl, 10 ); // enforce centering
}
if ( !text.isEmpty() ) {
QLabel *msg=0;
msg = new QLabel( text, vb, "msg_label" );
msg->setFont( *fntBody );
msg->setAlignment( AlignLeft );
}
pop->setTimeout(tOut);
//pop->setView( title, txt, SmallIcon("ktimer"));
pop->setView(vb);
pop->show();
}
示例10: KDialogBase
KateSessionChooser::KateSessionChooser(QWidget *parent, const QString &lastSession)
: KDialogBase(parent, "", true, i18n("Session Chooser"), KDialogBase::User1 | KDialogBase::User2 | KDialogBase::User3, KDialogBase::User2, true,
KStdGuiItem::quit(), KGuiItem(i18n("Open Session"), "fileopen"), KGuiItem(i18n("New Session"), "filenew"))
{
QHBox *page = new QHBox(this);
page->setMinimumSize(400, 200);
setMainWidget(page);
QHBox *hb = new QHBox(page);
hb->setSpacing(KDialog::spacingHint());
QLabel *label = new QLabel(hb);
label->setPixmap(UserIcon("sessionchooser"));
label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QVBox *vb = new QVBox(hb);
vb->setSpacing(KDialog::spacingHint());
m_sessions = new KListView(vb);
m_sessions->addColumn(i18n("Session Name"));
m_sessions->addColumn(i18n("Open Documents"));
m_sessions->setResizeMode(QListView::AllColumns);
m_sessions->setSelectionMode(QListView::Single);
m_sessions->setAllColumnsShowFocus(true);
connect(m_sessions, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
connect(m_sessions, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)), this, SLOT(slotUser2()));
KateSessionList &slist(KateSessionManager::self()->sessionList());
for(unsigned int i = 0; i < slist.count(); ++i)
{
KateSessionChooserItem *item = new KateSessionChooserItem(m_sessions, slist[i]);
if(slist[i]->sessionFileRelative() == lastSession)
m_sessions->setSelected(item, true);
}
m_useLast = new QCheckBox(i18n("&Always use this choice"), vb);
setResult(resultNone);
// trigger action update
selectionChanged();
}
示例11: showTryLaterMessageBox
void KBabelView::showTryLaterMessageBox()
{
if( !_showTryLaterBox ) return;
KDialogBase *dialog= new KDialogBase(
i18n("Information"),
KDialogBase::Yes,
KDialogBase::Yes, KDialogBase::Yes,
this, "information", true, true,
KStdGuiItem::ok() );
QVBox *topcontents = new QVBox (dialog);
topcontents->setSpacing(KDialog::spacingHint()*2);
topcontents->setMargin(KDialog::marginHint()*2);
QWidget *contents = new QWidget(topcontents);
QHBoxLayout * lay = new QHBoxLayout(contents);
lay->setSpacing(KDialog::spacingHint()*2);
lay->addStretch(1);
QLabel *label1 = new QLabel( contents);
label1->setPixmap(QMessageBox::standardIcon(QMessageBox::Information));
lay->add( label1 );
QLabel *label2 = new QLabel( i18n("The search string has not been found yet.\n"
"However, the string might be found "
"in the files being searched at the moment.\n"
"Please try later."), contents);
label2->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak );
label2->setMinimumSize(label2->sizeHint());
lay->add( label2 );
lay->addStretch(1);
QCheckBox *checkbox = new QCheckBox(i18n("Do not show in this find/replace session again"), topcontents);
dialog->setMainWidget(topcontents);
dialog->enableButtonSeparator(false);
dialog->incInitialSize( QSize(50,0) );
dialog->exec();
_showTryLaterBox = !checkbox->isChecked();
delete dialog;
}
示例12: buttonSizePolicy
BookmarksSettingsPage::BookmarksSettingsPage(QWidget*parent) :
SettingsPageBase(parent),
m_addButton(0),
m_removeButton(0),
m_moveUpButton(0),
m_moveDownButton(0)
{
QVBoxLayout* topLayout = new QVBoxLayout(parent, 2, KDialog::spacingHint());
const int spacing = KDialog::spacingHint();
QHBox* hBox = new QHBox(parent);
hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
hBox->setSpacing(spacing);
hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
m_listView = new KListView(hBox);
m_listView->addColumn(i18n("Icon"));
m_listView->addColumn(i18n("Name"));
m_listView->addColumn(i18n("Location"));
m_listView->setResizeMode(QListView::LastColumn);
m_listView->setColumnAlignment(0, Qt::AlignHCenter);
m_listView->setAllColumnsShowFocus(true);
m_listView->setSorting(-1);
connect(m_listView, SIGNAL(selectionChanged()),
this, SLOT(updateButtons()));
connect(m_listView, SIGNAL(pressed(QListViewItem*)),
this, SLOT(slotBookmarkPressed(QListViewItem*)));
connect(m_listView, SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)),
this, SLOT(slotBookmarkDoubleClicked(QListViewItem*, const QPoint&, int)));
QVBox* buttonBox = new QVBox(hBox);
buttonBox->setSpacing(spacing);
const QSizePolicy buttonSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
m_addButton = new KPushButton(i18n("Add..."), buttonBox);
connect(m_addButton, SIGNAL(clicked()),
this, SLOT(slotAddButtonClicked()));
m_addButton->setSizePolicy(buttonSizePolicy);
m_editButton = new KPushButton(i18n("Edit..."), buttonBox);
connect(m_editButton, SIGNAL(clicked()),
this, SLOT(slotEditButtonClicked()));
m_editButton->setSizePolicy(buttonSizePolicy);
m_removeButton = new KPushButton(i18n("Remove"), buttonBox);
connect(m_removeButton, SIGNAL(clicked()),
this, SLOT(slotRemoveButtonClicked()));
m_removeButton->setSizePolicy(buttonSizePolicy);
m_moveUpButton = new KPushButton(i18n("Move Up"), buttonBox);
connect(m_moveUpButton, SIGNAL(clicked()),
this, SLOT(slotMoveUpButtonClicked()));
m_moveUpButton->setSizePolicy(buttonSizePolicy);
m_moveDownButton = new KPushButton(i18n("Move Down"), buttonBox);
connect(m_moveDownButton, SIGNAL(clicked()),
this, SLOT(slotMoveDownButtonClicked()));
m_moveDownButton->setSizePolicy(buttonSizePolicy);
// Add a dummy widget with no restriction regarding a vertical resizing.
// This assures that the spacing between the buttons is not increased.
new QWidget(buttonBox);
topLayout->addWidget(hBox);
// insert all editable bookmarks.
KBookmarkGroup root = DolphinSettings::instance().bookmarkManager()->root();
KBookmark bookmark = root.first();
QListViewItem* prev = 0;
while (!bookmark.isNull()) {
QListViewItem* item = new QListViewItem(m_listView);
item->setPixmap(PixmapIdx, SmallIcon(bookmark.icon()));
item->setText(NameIdx, bookmark.text());
item->setText(URLIdx, bookmark.url().prettyURL());
// add hidden column to be able to retrieve the icon name again
item->setText(IconIdx, bookmark.icon());
m_listView->insertItem(item);
if (prev != 0) {
item->moveItem(prev);
}
prev = item;
bookmark = root.next(bookmark);
}
m_listView->setSelected(m_listView->firstChild(), true);
updateButtons();
}
示例13: KBookmarkHandler
FileBrowser::FileBrowser( const char * name, Medium * medium )
: QVBox( 0, name )
{
KActionCollection *actionCollection;
SearchPane *searchPane;
KURL *location;
// Try to keep filebrowser working even if not in a medium context
// so if a medium object not passed in, keep earlier behavior
if (!medium) {
m_medium = 0;
location = new KURL( Pana::config( "Filebrowser" )->readPathEntry( "Location", QDir::homeDirPath() ) );
KFileItem *currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location );
//KIO sucks, NetAccess::exists puts up a dialog and has annoying error message boxes
//if there is a problem so there is no point in using it anyways.
//so... setting the diroperator to ~ is the least sucky option
if ( !location->isLocalFile() || !currentFolder->isReadable() ) {
delete location;
location = new KURL( QDir::homeDirPath() ) ;
}
}
else{
m_medium = medium;
location = new KURL( m_medium->mountPoint() );
}
KActionCollection* ac = new KActionCollection( this );
KStdAction::selectAll( this, SLOT( selectAll() ), ac, "filebrowser_select_all" );
KToolBar *toolbar = new Browser::ToolBar( this );
{ //Filter LineEdit
KToolBar* searchToolBar = new Browser::ToolBar( this );
KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar );
m_filter = new ClickLineEdit( i18n( "Enter search terms here" ), searchToolBar );
searchToolBar->setStretchableWidget( m_filter );
connect( button, SIGNAL(clicked()), m_filter, SLOT(clear()) );
QToolTip::add( button, i18n( "Clear search field" ) );
QToolTip::add( m_filter, i18n( "Enter space-separated terms to search in the directory-listing" ) );
}
{ //Directory Listing
QVBox *container; QHBox *box;
container = new QVBox( this );
container->setFrameStyle( m_filter->frameStyle() );
container->setMargin( 3 );
container->setSpacing( 2 );
container->setBackgroundMode( Qt::PaletteBase );
box = new QHBox( container );
box->setMargin( 3 );
box->setBackgroundMode( Qt::PaletteBase );
//folder selection combo box
m_combo = new KURLComboBox( KURLComboBox::Directories, true, box, "path combo" );
if (!m_medium){
m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) );
m_combo->setAutoDeleteCompletionObject( true );
}
m_combo->setMaxItems( 9 );
m_combo->setURLs( Pana::config( "Filebrowser" )->readPathListEntry( "Dir History" ) );
if (!m_medium)
m_combo->lineEdit()->setText( location->path() );
else
m_combo->lineEdit()->setText( "/" );
//The main widget with file listings and that
m_dir = new MyDirOperator( *location, container, m_medium );
m_dir->setEnableDirHighlighting( true );
m_dir->setMode( KFile::Mode((int)KFile::Files | (int)KFile::Directory) ); //allow selection of multiple files + dirs
m_dir->setOnlyDoubleClickSelectsFiles( true ); //Pana type settings
m_dir->readConfig( Pana::config( "Filebrowser" ) );
m_dir->setView( KFile::Default ); //will set userconfigured view, will load URL
m_dir->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
m_dir->setAcceptDrops( true );
//Automatically open folder after hovering above it...probably a good thing
//but easily disabled by commenting this line out
//Disabled for now because can't show . and .. folders.
//TODO: Find out a way to fix this?
//m_dir->setDropOptions( KFileView::AutoOpenDirs );
static_cast<QFrame*>(m_dir->viewWidget())->setFrameStyle( QFrame::NoFrame );
static_cast<QIconView*>(m_dir->viewWidget())->setSpacing( 1 );
actionCollection = m_dir->actionCollection();
searchPane = new SearchPane( this );
setStretchFactor( container, 2 );
}
{
QPopupMenu* const menu = static_cast<KActionMenu*>(actionCollection->action("popupMenu"))->popupMenu();
//.........这里部分代码省略.........
示例14: createDisplayDock
QWidget* MyFracWindow::createDisplayDock(QWidget* parent)
{
QVBox* wrapper = new QVBox(parent);
wrapper->setSpacing(0);
QGrid* propDisplay = new QGrid(2, wrapper);
propDisplay->setMargin(7);
propDisplay->setSpacing(5);
new QLabel(i18n("Color gradient:"), propDisplay);
GradientButton* gradButton = new GradientButton(propDisplay);
connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), gradButton, SLOT(setGradient(const QRgb*, double, double)));
connect(gradButton, SIGNAL(clicked()), this, SLOT(onGradientEdit()));
QToolTip::add(gradButton, i18n("Gradient used to display the fractal"));
new QLabel(i18n("Color scale:"), propDisplay);
_sliderScale = new QSlider(QSlider::Horizontal, propDisplay);
_sliderScale->setRange(0, 100);
connect(_sliderScale, SIGNAL(valueChanged(int)), SLOT(setGradientScale(int)));
QToolTip::add(_sliderScale, i18n("Scale of the color gradient"));
new QLabel(i18n("Color offset:"), propDisplay);
_sliderOffset = new QSlider(QSlider::Horizontal, propDisplay);
_sliderOffset->setRange(0, 100);
connect(_sliderOffset, SIGNAL(valueChanged(int)), SLOT(setGradientOffset(int)));
QToolTip::add(_sliderOffset, i18n("Offset of the color gradient"));
new QLabel(i18n("Scroll colors:"), propDisplay);
QHBox* box = new QHBox(propDisplay);
box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
box->setSpacing(5);
QComboBox* combo = new QComboBox(box);
combo->insertItem(i18n("scroll direction", "Off"));
combo->insertItem(i18n("scroll direction", "Left"));
combo->insertItem(i18n("scroll direction", "Right"));
connect(combo, SIGNAL(activated(int)), SLOT(setScrollMode(int)));
_sliderScroll = new QSlider(QSlider::Horizontal, box);
_sliderScroll->setRange(0, 100);
_sliderScroll->setEnabled(false);
connect(_sliderScroll, SIGNAL(valueChanged(int)), SLOT(setScrollSpeed(int)));
QToolTip::add(combo, i18n("Scrolling direction"));
QToolTip::add(_sliderScroll, i18n("Scrolling speed"));
new QLabel(i18n("Background:"), propDisplay);
_colorButton = new KColorButton(_backgroundColor, propDisplay);
connect(_colorButton, SIGNAL(changed(const QColor&)), SLOT(selectBackground(const QColor&)));
QToolTip::add(_colorButton, i18n("Color of the background area"));
new QLabel(i18n("3D grid size:"), propDisplay);
_comboGrid = new QComboBox(propDisplay);
for (int i = 64; i <= 1024; i *= 2)
_comboGrid->insertItem(i18n("%1 x %2").arg(i).arg(i));
_comboGrid->setEnabled(false);
connect(_comboGrid, SIGNAL(activated(int)), SLOT(setGridSize(int)));
QToolTip::add(_comboGrid, i18n("Resolution of the 3D mesh"));
new QLabel(i18n("Height scale:"), propDisplay);
_sliderHeight = new QSlider(QSlider::Horizontal, propDisplay);
_sliderHeight->setRange(0, 100);
_sliderHeight->setEnabled(false);
connect(_sliderHeight, SIGNAL(valueChanged(int)), SLOT(setHeightScale(int)));
QToolTip::add(_sliderHeight, i18n("Height scale of the 3D mesh"));
wrapper->setStretchFactor(new QWidget(wrapper), 1);
return wrapper;
}
示例15: setupCentralWidget
void SimpleUI::setupCentralWidget()
{
QVBox *npWidget = new QVBox( this );
npWidget->setMargin( 0 );
npWidget->setSpacing( 0 );
positionLabel = new QLabel( statusBar() );
positionLabel->setAlignment( AlignVCenter | AlignCenter );
positionLabel->setFixedSize( fontMetrics().size( 0, " 00:00/00:00 " ) );
statusBar()->addWidget( positionLabel, 0, true );
video = new VideoFrame( npWidget );
connect( video, SIGNAL(adaptSize(int,int)),
SLOT(slotAdaptSize(int,int)) );
connect( video, SIGNAL(rightButtonPressed(const QPoint &)),
SLOT(slotContextMenu(const QPoint &)) );
QHBox *ctlFrame = new QHBox( npWidget );
ctlFrame->setFixedHeight( 38 );
ctlFrame->setFrameShape( QFrame::StyledPanel );
ctlFrame->setFrameShadow( QFrame::Raised );
ctlFrame->setMargin( 6 );
ctlFrame->setSpacing( 6 );
QPushButton *backButton = new QPushButton( ctlFrame );
backButton->setFixedSize( 24, 24 );
backButton->setPixmap( QPixmap( back_xpm ) );
QToolTip::add( backButton, i18n("Back") );
connect( backButton, SIGNAL(clicked()), napp->player(), SLOT(back()) );
stopButton = new QPushButton( ctlFrame );
stopButton->setFixedSize( 24, 24 );
stopButton->setPixmap( QPixmap( stop_xpm ) );
QToolTip::add( stopButton, i18n("Stop") );
connect( stopButton, SIGNAL(clicked()), napp->player(), SLOT(stop()) );
playButton = new QPushButton( ctlFrame );
playButton->setFixedSize( 24, 24 );
playButton->setPixmap( QPixmap( play_xpm ) );
QToolTip::add( playButton, i18n("Play / Pause") );
connect( playButton, SIGNAL(clicked()), napp->player(), SLOT(playpause()) );
QPushButton *forwButton = new QPushButton( ctlFrame );
forwButton->setFixedSize( 24, 24 );
forwButton->setPixmap( QPixmap( forward_xpm ) );
QToolTip::add( forwButton, i18n("Forward") );
connect( forwButton, SIGNAL(clicked()), napp->player(), SLOT(forward()) );
slider = new L33tSlider( 0, 1000, 10, 0, L33tSlider::Horizontal, ctlFrame );
slider->setFixedHeight( 24 );
slider->setMinimumWidth( 100 );
slider->setTickmarks( QSlider::NoMarks );
connect( slider, SIGNAL(userChanged(int)), SLOT(slotSkipTo(int)) );
connect( slider, SIGNAL(sliderMoved(int)), SLOT(slotSliderMoved(int)) );
QPushButton *playlistButton = new QPushButton( ctlFrame );
playlistButton->setFixedSize( 24, 24 );
playlistButton->setPixmap( QPixmap( playlist_xpm ) );
QToolTip::add( playlistButton, i18n("Playlist") );
connect( playlistButton, SIGNAL(clicked()), napp->player(), SLOT(toggleListView()) );
volumeButton = new QPushButton( ctlFrame );
volumeButton->setFixedSize( 24, 24 );
volumeButton->setPixmap( QPixmap( volume_xpm ) );
QToolTip::add( volumeButton, i18n("Volume") );
volumeFrame = new QVBox( this, "Volume", WStyle_Customize | WType_Popup );
volumeFrame->setFrameStyle( QFrame::PopupPanel );
volumeFrame->setMargin( 4 );
volumeLabel = new QLabel( volumeFrame );
volumeLabel->setText( "100%" );
volumeLabel->setAlignment( AlignCenter );
volumeLabel->setFixedSize( volumeLabel->sizeHint() );
QHBox *volumeSubFrame = new QHBox( volumeFrame );
volumeSlider = new L33tSlider( 0, 100, 10, 0, Vertical, volumeSubFrame );
volumeSlider->setValue( 100 - napp->player()->volume() );
volumeSlider->setFixedSize( volumeSlider->sizeHint() );
volumeFrame->resize( volumeFrame->sizeHint() );
connect( volumeSlider, SIGNAL(sliderMoved(int)), SLOT(slotVolumeSliderMoved(int)) );
connect( volumeSlider, SIGNAL(userChanged(int)), SLOT(slotVolumeSliderMoved(int)) );
connect( volumeButton, SIGNAL(clicked()), SLOT(slotVolumeFrame()) );
setCentralWidget( npWidget );
video->setMinimumSize( minimumSizeHint().width(), 1 );
// Create properties dialog
propertiesDialog = new PropertiesDialog( this );
propertiesDialog->resize( 375, 285 );
}