本文整理汇总了C++中QObjectList::first方法的典型用法代码示例。如果您正苦于以下问题:C++ QObjectList::first方法的具体用法?C++ QObjectList::first怎么用?C++ QObjectList::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QObjectList
的用法示例。
在下文中一共展示了QObjectList::first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: d
KexiStartupFileDialogBase::KexiStartupFileDialogBase(
const QString & dirName, const QString & filter,
QWidget * parent, const char * name, bool modal)
: Q3FileDialog(realStartDir(dirName), filter, parent, name, modal)
, d(new KexiStartupFileDialogBasePrivate())
{
// QString _dirName = dirName;
QString _dirName = dirPath();
//make default 'My Documents' folder
//TODO: store changes in the app's config file?
if (_dirName.isEmpty())
_dirName = KGlobalSettings::documentPath();
init(_dirName, filter, parent);
//find "OK" button
QObjectList *l = queryList("QPushButton", "OK", false);
m_okBtn = dynamic_cast<QPushButton*>(l->first());
delete l;
l = queryList("QLineEdit", "name/filter editor", false);
m_lineEdit = dynamic_cast<QLineEdit*>(l->first());
delete l;
adjustSize();
}
示例2: doConnections
void MetaDataBase::doConnections( QObject *o )
{
setupDataBase();
MetaDataBaseRecord *r = db->find( (void*)o );
if ( !r ) {
qWarning( "No entry for %p (%s, %s) found in MetaDataBase",
o, o->name(), o->className() );
return;
}
QObject *sender = 0, *receiver = 0;
QObjectList *l = 0;
QValueList<Connection>::Iterator it = r->connections.begin();
for ( ; it != r->connections.end(); ++it ) {
Connection conn = *it;
if ( qstrcmp( conn.sender->name(), o->name() ) == 0 ) {
sender = o;
} else {
l = o->queryList( 0, conn.sender->name(), false );
if ( !l || !l->first() ) {
delete l;
continue;
}
sender = l->first();
delete l;
}
if ( qstrcmp( conn.receiver->name(), o->name() ) == 0 ) {
receiver = o;
} else {
l = o->queryList( 0, conn.receiver->name(), false );
if ( !l || !l->first() ) {
delete l;
continue;
}
receiver = l->first();
delete l;
}
QString s = "2""%1";
s = s.arg( conn.signal );
QString s2 = "1""%1";
s2 = s2.arg( conn.slot );
QStrList signalList = sender->metaObject()->signalNames( true );
QStrList slotList = receiver->metaObject()->slotNames( true );
// avoid warnings
if ( signalList.find( conn.signal ) == -1 ||
slotList.find( conn.slot ) == -1 )
continue;
QObject::connect( sender, s, receiver, s2 );
}
}
示例3: signalHandler
static void signalHandler( QT_SIGNAL_ARGS )
{
QFile f( QDir::homeDirPath() + "/.designerargs" );
f.open( IO_ReadOnly );
QString args;
f.readLine( args, f.size() );
QStringList lst = QStringList::split( " ", args );
for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
QString arg = (*it).stripWhiteSpace();
if ( arg[0] != '-' ) {
QObjectList* l = MainWindow::self->queryList( "FormWindow" );
FormWindow* fw = (FormWindow*) l->first();
#if 0 // ### what's this dead code for?
FormWindow* totop;
#endif
bool haveit = FALSE;
while ( fw ) {
haveit = haveit || fw->fileName() == arg;
#if 0 // ### what's this dead code for?
if ( haveit )
totop = fw;
#endif
fw = (FormWindow*) l->next();
}
if ( !haveit )
MainWindow::self->openFormWindow( arg );
}
}
MainWindow::self->raise();
MainWindow::self->setActiveWindow();
}
示例4: ArbiterWidget
void
PatternWidgetClass::init()
{
// delete all childs
QObjectList * childs;
while((childs = const_cast<QObjectList *>(this->children())) != NULL &&
!childs->isEmpty()) {
delete childs->first();
}
// resize widget //
int numBehaviours = getDocument().getNumBehaviours(patternName);
setFixedSize(100,
PATTERN_NAME_HEIGHT +
BEHAVIOUR_NAME_HEIGHT * numBehaviours +
ARBITER_NAME_HEIGHT +
2*frameWidth());
// get internal rect dimensions (inside the frame) //
QRect cr = contentsRect();
//----------------//
// behaviour list //
//----------------//
// get string list with behaviour names //
QStringList list = getDocument().getBehaviourNames(patternName);
// show all behaviour names //
int i = 0;
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
QString behName = (*it);
// create new label //
BehaviourWidget* behWidget = new BehaviourWidget(this, behName);
behWidget->setGeometry(cr.x(),
cr.y()+PATTERN_NAME_HEIGHT+i*BEHAVIOUR_NAME_HEIGHT,
cr.width(), BEHAVIOUR_NAME_HEIGHT);
behWidget->show();
i++;
}
//---------//
// arbiter //
//---------//
ArbiterWidget * arbiterWidget =
new ArbiterWidget(this, getDocument().getArbiter(patternName));
arbiterWidget->setGeometry(cr.x(), cr.y()+cr.height()-ARBITER_NAME_HEIGHT,
cr.width(), ARBITER_NAME_HEIGHT);
arbiterWidget->show();
update();
}
示例5: installEventFilters
void QDesignerToolBar::installEventFilters( QWidget *w )
{
if ( !w )
return;
QObjectList *l = w->queryList( "QWidget" );
for ( QObject *o = l->first(); o; o = l->next() )
o->installEventFilter( this );
delete l;
}
示例6: subfolders
QStringList Folder::subfolders()
{
QStringList lst = QStringList();
QObjectList* folderLst = (QObjectList*)children();
if (!folderLst)
return lst;
if (folderLst)
{
Folder *f;
for (f = (Folder*)folderLst->first(); f; f = (Folder*)folderLst->next())
lst << f->folderName();
}
return lst;
}
示例7: setModified
void
DocumentXML::clear()
{
document_.removeChild(document_.documentElement());
setModified(true);
if (children()) {
QObjectList childList = *children();
QObject * c = childList.first();
while (c) {
delete c;
c = childList.next();
}
}
}
示例8: setErrorMessages
void OutputWindow::setErrorMessages( const QStringList &errors, const QValueList<uint> &lines,
bool clear, const QStringList &locations,
const QObjectList &locationObjects )
{
if ( clear )
errorView->clear();
QStringList::ConstIterator mit = errors.begin();
QValueList<uint>::ConstIterator lit = lines.begin();
QStringList::ConstIterator it = locations.begin();
QObjectList objects = (QObjectList)locationObjects;
QObject *o = objects.first();
QListViewItem *after = 0;
for ( ; lit != lines.end() && mit != errors.end(); ++lit, ++mit, ++it, o = objects.next() )
after = new ErrorItem( errorView, after, *mit, *lit, *it, o );
setCurrentPage( 1 );
}
示例9: QStatusBar
QStatusBar * QMainWindow::statusBar() const
{
if ( d->sb )
return d->sb;
QObjectList * l
= ((QObject*)this)->queryList( "QStatusBar", 0, FALSE, FALSE );
QStatusBar * s;
if ( l && l->count() )
s = (QStatusBar *)l->first();
else
s = new QStatusBar( (QMainWindow *)this, "automatic status bar" );
delete l;
((QMainWindow *)this)->setStatusBar( s );
return s;
}
示例10: QMenuBar
QMenuBar * QMainWindow::menuBar() const
{
if ( d->mb )
return d->mb;
QObjectList * l
= ((QObject*)this)->queryList( "QMenuBar", 0, FALSE, FALSE );
QMenuBar * b;
if ( l && l->count() )
b = (QMenuBar *)l->first();
else
b = new QMenuBar( (QMainWindow *)this, "automatic menu bar" );
delete l;
((QMainWindowPrivate*)d)->mb = b;
d->mb->installEventFilter( this );
((QMainWindow *)this)->triggerLayout();
return b;
}
示例11: sizeToString
QString Folder::sizeToString()
{
int size = 0;
QObjectList* folderLst = (QObjectList*)children();
if (folderLst)
{
Folder *f;
for (f = (Folder*)folderLst->first(); f; f = (Folder*)folderLst->next())
size += sizeof(f);
}
myWidget *w;
for (w = lstWindows.first(); w ; w = lstWindows.next())
size += sizeof(w);
return QString::number(8*size/1024.0,'f',1)+" "+tr("kB")+" ("+QString::number(8*size)+" "+tr("bytes")+")";
}
示例12: while
void
PolicyView::init(PolicyXML * _policy)
{
if (policy_ == _policy)
return;
// delete all childs
QObjectList * childs;
while((childs = const_cast<QObjectList *>(viewport()->children())) != NULL &&
!childs->isEmpty()) {
delete childs->first();
}
policy_ = _policy;
if (policy_ == NULL)
return;
policy_->setWidget(this);
//-------------------------
// rebuild the widget list
QListViewItem * i = policy_->listViewItem()->firstChild();
while (i != NULL) {
Item * item = policy_->itemFromListViewItem(i);
PatternXML * pattern = dynamic_cast<PatternXML *>(item);
if (pattern != NULL)
addPatternWidget(pattern);
i = i->nextSibling();
}
QRect r = viewport()->childrenRect();
QPoint s = viewportToContents(r.bottomRight());
resizeContents(s.x(), s.y());
setContentsPos(0, 0);
}
示例13: findSubfolder
Folder* Folder::findSubfolder(const QString& s, bool caseSensitive, bool partialMatch)
{
QObjectList* folderLst = (QObjectList*)children();
if (folderLst)
{
Folder *f;
for (f = (Folder*)folderLst->first(); f; f = (Folder*)folderLst->next())
{
QString name = f->folderName();
if (partialMatch && name.startsWith(s, caseSensitive))
return f;
else if (caseSensitive && name == s)
return f;
else
{
QString text = s;
if (name == text.lower())
return f;
}
}
}
return 0;
}
示例14: while
void
PolicyViewClass::init()
{
// delete all childs
QObjectList * childs;
while((childs = const_cast<QObjectList *>(viewport()->children())) != NULL &&
!childs->isEmpty()) {
delete childs->first();
}
//-------------------------//
// rebuild the widget list //
//-------------------------//
QStringList list = document.getPatternNames();
QStringList::Iterator patternIter = list.begin();
while (patternIter !=list.end()) {
// generate pattern widget //
QString patternName = *patternIter;
PatternWidgetClass* patternWidget = new PatternWidgetClass(this, viewport(), patternName);
patternWidget->show();
int x = std::max(0, document.getX(patternName));
int y = std::max(0, document.getY(patternName));
addChild(patternWidget, x, y);
patternIter++;
}
QRect r = viewport()->childrenRect();
QPoint s = viewportToContents(r.bottomRight());
resizeContents(s.x(), s.y());
setContentsPos(0, 0);
}
示例15: CollectionSetup
AmarokConfigDialog::AmarokConfigDialog( QWidget *parent, const char* name, KConfigSkeleton *config )
: KConfigDialog( parent, name, config )
, m_engineConfig( 0 )
, m_opt4( 0 )
{
setWFlags( WDestructiveClose );
// IMPORTANT Don't simply change the page names, they are used as identifiers in other parts of the app.
m_opt1 = new Options1( 0, "General" );
m_opt2 = new Options2( 0, "Appearance" );
m_opt4 = new Options4( 0, "Playback" );
Options5 *opt5 = new Options5( 0, "OSD" );
QVBox *opt6 = new QVBox;
m_opt7 = new Options7( 0, "Collection" );
Options8 *opt8 = new Options8( 0, "Scrobbler" );
QVBox *opt9 = new QVBox;
// Sound System
opt6->setName( "Engine" );
opt6->setSpacing( KDialog::spacingHint() );
QWidget *groupBox, *aboutEngineButton;
groupBox = new QGroupBox( 2, Qt::Horizontal, i18n("Sound System"), opt6 );
m_engineConfigFrame = new QGroupBox( 1, Qt::Horizontal, opt6 );
m_soundSystem = new QComboBox( false, groupBox );
aboutEngineButton = new QPushButton( i18n("About"), groupBox );
QToolTip::add( m_soundSystem, i18n("Click to select the sound system to use for playback.") );
QToolTip::add( aboutEngineButton, i18n("Click to get the plugin information.") );
/// Populate the engine selection combo box
KTrader::OfferList offers = PluginManager::query( "[X-KDE-amaroK-plugintype] == 'engine'" );
KTrader::OfferList::ConstIterator end( offers.end() );
for( KTrader::OfferList::ConstIterator it = offers.begin(); it != end; ++it ) {
// Don't list the <no engine> (void engine) entry if it's not currenty active,
// cause there's no point in choosing this engine (it's a dummy, after all).
if( (*it)->property( "X-KDE-amaroK-name" ).toString() == "void-engine"
&& AmarokConfig::soundSystem() != "void-engine" ) continue;
m_soundSystem->insertItem( (*it)->name() );
// Save name properties in QMap for lookup
m_pluginName[(*it)->name()] = (*it)->property( "X-KDE-amaroK-name" ).toString();
m_pluginAmarokName[(*it)->property( "X-KDE-amaroK-name" ).toString()] = (*it)->name();
}
// Collection
#if !defined(USE_MYSQL) && !defined(USE_POSTGRESQL)
m_opt7->databaseBox->hide();
#endif
#ifndef USE_MYSQL
//FIXME we do this because this widget breaks the Apply button (always enabled).
//It breaks because it is set to type="password" in the .kcfg file. Setting to
//type="string" also fixes this bug, but means the password is stored in plain
//text. This is a temporary fix so that the majority of users get a fixed Apply
//button.
delete m_opt7->dbSetupFrame->kcfg_MySqlPassword2;
#endif
m_opt7->collectionFoldersBox->setColumns( 1 );
new CollectionSetup( m_opt7->collectionFoldersBox ); //TODO this widget doesn't update the apply/ok buttons
// Media Devices
opt9->setName( "Media Devices" );
opt9->setSpacing( KDialog::spacingHint() );
QVBox *topbox = new QVBox( opt9 );
topbox->setSpacing( KDialog::spacingHint() );
QGroupBox *mediaBox = new QGroupBox( 2, Qt::Horizontal, i18n("Media Devices"), topbox );
mediaBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
QVBox *vbox = new QVBox( mediaBox );
vbox->setSpacing( KDialog::spacingHint() );
m_deviceManager = new MediumPluginManager( vbox );
QHBox *hbox = new QHBox( topbox );
hbox->setSpacing( KDialog::spacingHint() );
hbox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
KPushButton *autodetect = new KPushButton( i18n( "Autodetect Devices" ), hbox );
autodetect->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
connect( autodetect, SIGNAL(clicked()), m_deviceManager, SLOT(redetectDevices()) );
KPushButton *add = new KPushButton( i18n( "Add Device..." ), hbox );
add->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
connect( add, SIGNAL(clicked()), m_deviceManager, SLOT(newDevice()) );
QFrame *frame = new QFrame( topbox );
frame->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
// add pages
addPage( m_opt1, i18n( "General" ), "misc", i18n( "Configure General Options" ) );
addPage( m_opt2, i18n( "Appearance" ), "colors", i18n( "Configure amaroK's Appearance" ) );
addPage( m_opt4, i18n( "Playback" ), "kmix", i18n( "Configure Playback" ) );
addPage( opt5, i18n( "OSD" ), "tv", i18n( "Configure On-Screen-Display" ) );
addPage( opt6, i18n( "Engine" ), "amarok", i18n( "Configure Engine" ) );
addPage( m_opt7, i18n( "Collection" ), amaroK::icon( "collection" ), i18n( "Configure Collection" ) );
addPage( opt8, i18n( "last.fm" ), "audioscrobbler", i18n( "Configure last.fm Support" ) );
addPage( opt9, i18n( "Media Devices" ), amaroK::icon( "device" ), i18n( "Configure Portable Player Support" ) );
// Show information labels (must be done after insertions)
QObjectList *list = queryList( "QLabel", "infoPixmap" );
for( QObject *label = list->first(); label; label = list->next() )
static_cast<QLabel*>(label)->setPixmap( QMessageBox::standardIcon( QMessageBox::Information ) );
delete list;
//.........这里部分代码省略.........