本文整理汇总了C++中QValueList类的典型用法代码示例。如果您正苦于以下问题:C++ QValueList类的具体用法?C++ QValueList怎么用?C++ QValueList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QValueList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
QWidgetModuleDefault::QWidgetModuleDefault(Searchable& config, QWidget* parent, const char* name, bool modal, WFlags fl)
: QWidget(parent, name, fl),
_qwViewer(NULL),
_qwOutput(NULL),
_qwRPC(NULL),
_qwConnections(NULL){
Property prop;
prop.fromString(config.toString());
if(!prop.check("name")){
prop.put("name", "/moduleGui");
}
this->setCaption("Yarp Default Module Interface");
// main layout (vbox)
QVBoxLayout *mainLayout = new QVBoxLayout( this, 3, 3, "QWidgetModuleDefaultBaseLayout");
// add a vertical split as first entry to main layout
QSplitter *splitMain = new QSplitter(this);
mainLayout->addWidget(splitMain);
// add horizontal splitter to left part of main splitter
QSplitter *splitLeft = new QSplitter(Qt::Vertical, splitMain);
Property propViewer; propViewer.fromString(prop.toString());
propViewer.put("name", std::string(std::string(propViewer.find("name").asString().c_str()) + std::string("/viewer")).c_str());
_qwViewer = new QWidgetViewer(propViewer, splitLeft); // the viewer widget
_qwConnections = new QWidgetConnections(prop, splitLeft); // the connection widget
// add horizontal splitter to right part of main splitter
QSplitter *splitRight = new QSplitter(Qt::Vertical, splitMain);
Property propOutput; propOutput.fromString(prop.toString());
propOutput.put("name", std::string(std::string(propOutput.find("name").asString().c_str()) + std::string("/stdout")).c_str());
_qwOutput = new QWidgetOutput(propOutput, splitRight); // the output widget
Property propRPC; propRPC.fromString(prop.toString());
propRPC.put("name", std::string(std::string(propRPC.find("name").asString().c_str()) + std::string("/rpc")).c_str());
_qwRPC = new QWidgetRPC(propRPC, splitRight); // the RPC widget
// add a frame as second entry in main layout
QFrame *frmBottom = new QFrame(this);
frmBottom->setMaximumHeight(35);
mainLayout->addWidget(frmBottom);
// add a layout to the bottom frame
QHBoxLayout *frmBottomLayout = new QHBoxLayout(frmBottom, 0, -1, "frmBottomLayout");
frmBottomLayout->setSpacing(3);
frmBottomLayout->setMargin(3);
// add a button to the bottom frame
QPushButton *btnCheckAll = new QPushButton(frmBottom);
btnCheckAll->setText("check all ports and connections");
frmBottomLayout->addWidget(btnCheckAll);
connect( btnCheckAll, SIGNAL( clicked() ), this, SLOT( btnCheckAll_clicked() ) );
this->resize(850,650);
QValueList<int> valsSplitMain;
valsSplitMain.append(400);
valsSplitMain.append(450);
splitMain->setSizes(valsSplitMain);
QValueList<int> valsSplitLeft;
valsSplitLeft.append(400);
valsSplitLeft.append(250);
splitLeft->setSizes(valsSplitLeft);
QValueList<int> valsSplitRight;
valsSplitRight.append(400);
valsSplitRight.append(250);
splitRight->setSizes(valsSplitRight);
// position screen center
QWidget* desk = QApplication::desktop();
this->move(desk->width()/2 - this->width()/2,desk->height()/2 - this->height()/2);
}
示例2: lineEdit
/*
Handle Ctrl+Cursor etc better than the Qt widget, which always
jumps to the next whitespace. This code additionally jumps to
the next [/#?:], which makes more sense for URLs. The list of
chars that will stop the cursor are '/', '.', '?', '#', ':'.
*/
void KLSHistoryCombo::selectWord(QKeyEvent *e)
{
QLineEdit* edit = lineEdit();
QString text = edit->text();
int pos = edit->cursorPosition();
int pos_old = pos;
int count = 0;
// TODO: make these a parameter when in kdelibs/kdeui...
QValueList<QChar> chars;
chars << QChar('/') << QChar('.') << QChar('?') << QChar('#') << QChar(':');
bool allow_space_break = true;
if( e->key() == Key_Left || e->key() == Key_Backspace )
{
do
{
pos--;
count++;
if( allow_space_break && text[pos].isSpace() && count > 1 )
break;
}
while( pos >= 0 && (chars.findIndex(text[pos]) == -1 || count <= 1) );
if( e->state() & ShiftButton )
{
edit->cursorForward(true, 1-count);
}
else if( e->key() == Key_Backspace )
{
edit->cursorForward(false, 1-count);
QString text = edit->text();
int pos_to_right = edit->text().length() - pos_old;
QString cut = text.left(edit->cursorPosition()) + text.right(pos_to_right);
edit->setText(cut);
edit->setCursorPosition(pos_old-count+1);
}
else
{
edit->cursorForward(false, 1-count);
}
}
else if( e->key() == Key_Right || e->key() == Key_Delete )
{
do
{
pos++;
count++;
if( allow_space_break && text[pos].isSpace() )
break;
}
while( pos < (int) text.length() && chars.findIndex(text[pos]) == -1 );
if( e->state() & ShiftButton )
{
edit->cursorForward(true, count+1);
}
else if( e->key() == Key_Delete )
{
edit->cursorForward(false, -count-1);
QString text = edit->text();
int pos_to_right = text.length() - pos - 1;
QString cut = text.left(pos_old) +
(pos_to_right > 0 ? text.right(pos_to_right) : QString() );
edit->setText(cut);
edit->setCursorPosition(pos_old);
}
else
{
edit->cursorForward(false, count+1);
}
}
}
示例3: debug
bool
HelixEngine::init()
{
debug() << "Initializing HelixEngine\n";
struct stat s;
bool exists = false;
stop();
m_state = Engine::Empty;
m_numPlayers = 2;
m_current = 1;
m_coredir = HelixConfig::coreDirectory();
if (m_coredir.isEmpty())
m_coredir = HELIX_LIBS "/common";
m_pluginsdir = HelixConfig::pluginDirectory();
if (m_pluginsdir.isEmpty())
m_pluginsdir = HELIX_LIBS "/plugins";
m_codecsdir = HelixConfig::codecsDirectory();
if (m_codecsdir.isEmpty())
m_codecsdir = HELIX_LIBS "/codecs";
if (HelixConfig::outputplugin() == "oss")
setOutputSink( HelixSimplePlayer::OSS );
else
{
setOutputSink( HelixSimplePlayer::ALSA );
if (HelixConfig::deviceenabled())
setDevice( HelixConfig::device().utf8() );
else
setDevice("default");
}
if (!stat(m_coredir.utf8(), &s) && !stat(m_pluginsdir.utf8(), &s) && !stat(m_codecsdir.utf8(), &s))
{
long vol=0;
bool eqenabled=false;
int savedpreamp=0;
QValueList<int> savedequalizerGains;
if (m_inited)
{
vol = PlayerControl::getVolume();
eqenabled = PlayerControl::isEQenabled();
for (unsigned int i=0; i < m_equalizerGains.size(); i++)
savedequalizerGains.append(m_equalizerGains[i]);
savedpreamp = m_preamp;
PlayerControl::tearDown();
}
PlayerControl::init(m_coredir.utf8(), m_pluginsdir.utf8(), m_codecsdir.utf8(), 2);
if (PlayerControl::initDirectSS())
{
fallbackToOSS();
PlayerControl::initDirectSS();
}
if (m_inited)
{
PlayerControl::setVolume(vol);
setEqualizerEnabled(eqenabled);
setEqualizerParameters(savedpreamp, savedequalizerGains);
}
m_inited = exists = true;
}
if (!exists || PlayerControl::getError())
{
KMessageBox::error( 0, i18n("The Helix Engine requires the RealPlayer(tm) or HelixPlayer libraries to be installed. Please make sure one is installed, and adjust the paths in \"Pana Settings\" -> \"Engine\"") );
// we need to return true here so that the user has an oppportunity to change the directory
//return false;
return true;
}
// create a list of mime types and ext for use in canDecode()
m_mimes.resize( getMimeListLen() );
int i = 0;
const MimeList *ml = getMimeList();
MimeEntry *entry;
while (ml)
{
QString mt = ml->mimetypes;
QString me = ml->mimeexts;
entry = new MimeEntry;
entry->type = QStringList::split('|', mt);
entry->ext = QStringList::split('|', me);
m_mimes[i] = *entry;
debug() << ml->mimetypes << endl;
i++;
ml = ml->fwd;
}
//.........这里部分代码省略.........
示例4: initUI
void LayoutConfig::initUI()
{
const char *modelName = m_rules->models()[m_kxkbConfig.m_model];
if(modelName == NULL)
modelName = DEFAULT_MODEL;
widget->comboModel->setCurrentText(i18n(modelName));
QValueList< LayoutUnit > otherLayouts = m_kxkbConfig.m_layouts;
widget->listLayoutsDst->clear();
// to optimize we should have gone from it.end to it.begin
QValueList< LayoutUnit >::ConstIterator it;
for(it = otherLayouts.begin(); it != otherLayouts.end(); ++it)
{
QListViewItemIterator src_it(widget->listLayoutsSrc);
LayoutUnit layoutUnit = *it;
for(; src_it.current(); ++src_it)
{
QListViewItem *srcItem = src_it.current();
if(layoutUnit.layout == src_it.current()->text(LAYOUT_COLUMN_MAP))
{ // check if current config knows about this layout
QListViewItem *newItem = copyLVI(srcItem, widget->listLayoutsDst);
newItem->setText(LAYOUT_COLUMN_VARIANT, layoutUnit.variant);
newItem->setText(LAYOUT_COLUMN_INCLUDE, layoutUnit.includeGroup);
newItem->setText(LAYOUT_COLUMN_DISPLAY_NAME, layoutUnit.displayName);
widget->listLayoutsDst->insertItem(newItem);
newItem->moveItem(widget->listLayoutsDst->lastItem());
break;
}
}
}
// display KXKB switching options
widget->chkShowSingle->setChecked(m_kxkbConfig.m_showSingle);
widget->chkShowFlag->setChecked(m_kxkbConfig.m_showFlag);
widget->chkEnableOptions->setChecked(m_kxkbConfig.m_enableXkbOptions);
widget->checkResetOld->setChecked(m_kxkbConfig.m_resetOldOptions);
switch(m_kxkbConfig.m_switchingPolicy)
{
default:
case SWITCH_POLICY_GLOBAL:
widget->grpSwitching->setButton(0);
break;
case SWITCH_POLICY_WIN_CLASS:
widget->grpSwitching->setButton(1);
break;
case SWITCH_POLICY_WINDOW:
widget->grpSwitching->setButton(2);
break;
}
widget->chkEnableSticky->setChecked(m_kxkbConfig.m_stickySwitching);
widget->spinStickyDepth->setEnabled(m_kxkbConfig.m_stickySwitching);
widget->spinStickyDepth->setValue(m_kxkbConfig.m_stickySwitchingDepth);
updateStickyLimit();
widget->chkEnable->setChecked(m_kxkbConfig.m_useKxkb);
widget->grpLayouts->setEnabled(m_kxkbConfig.m_useKxkb);
widget->optionsFrame->setEnabled(m_kxkbConfig.m_useKxkb);
// display xkb options
QStringList options = QStringList::split(',', m_kxkbConfig.m_options);
for(QStringList::ConstIterator it = options.begin(); it != options.end(); ++it)
{
QString option = *it;
QString optionKey = option.mid(0, option.find(':'));
QString optionName = m_rules->options()[option];
OptionListItem *item = m_optionGroups[i18n(optionKey.latin1())];
if(item != NULL)
{
OptionListItem *child = item->findChildItem(option);
if(child)
child->setState(QCheckListItem::On);
else
kdDebug() << "load: Unknown option: " << option << endl;
}
else
{
kdDebug() << "load: Unknown option group: " << optionKey << " of " << option << endl;
}
}
updateOptionsCommand();
emit KCModule::changed(false);
}
示例5: QPoint
void Layout::setup()
{
startPoint = QPoint( 32767, 32767 );
QValueList<QWidgetList> lists;
QWidget *lastParent = 0;
QWidgetList *lastList = 0;
QWidget *w = 0;
// Go through all widgets of the list we got. As we can only
// layout widgets which have the same parent, we first do some
// sorting which means create a list for each parent containing
// its child here. After that we keep working on the list of
// childs which has the most entries.
// Widgets which are already laid out are thrown away here too
for ( w = widgets.first(); w; w = widgets.next() ) {
if ( w->parentWidget() && WidgetFactory::layoutType( w->parentWidget() ) != WidgetFactory::NoLayout )
continue;
if ( lastParent != w->parentWidget() ) {
lastList = 0;
lastParent = w->parentWidget();
QValueList<QWidgetList>::Iterator it = lists.begin();
for ( ; it != lists.end(); ++it ) {
if ( ( *it ).first()->parentWidget() == w->parentWidget() )
lastList = &( *it );
}
if ( !lastList ) {
QWidgetList l;
l.setAutoDelete( FALSE );
lists.append( l );
lastList = &lists.last();
}
}
lastList->append( w );
}
// So, now find the list with the most entries
lastList = 0;
QValueList<QWidgetList>::Iterator it = lists.begin();
for ( ; it != lists.end(); ++it ) {
if ( !lastList || ( *it ).count() > lastList->count() )
lastList = &( *it );
}
// If we found no list (because no widget did fit at all) or the
// best list has only one entry and we do not layout a container,
// we leave here.
if ( !lastList || ( lastList->count() < 2 &&
( !layoutBase ||
( !WidgetDatabase::isContainer( WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( layoutBase ) ) ) &&
layoutBase != formWindow->mainContainer() ) )
) ) {
widgets.clear();
startPoint = QPoint( 0, 0 );
return;
}
// Now we have a new and clean widget list, which makes sense
// to layout
widgets = *lastList;
// Also use the only correct parent later, so store it
parent = WidgetFactory::widgetOfContainer( widgets.first()->parentWidget() );
// Now calculate the position where the layout-meta-widget should
// be placed and connect to widgetDestroyed() signals of the
// widgets to get informed if one gets deleted to be able to
// handle that and do not crash in this case
for ( w = widgets.first(); w; w = widgets.next() ) {
connect( w, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ) );
startPoint = QPoint( QMIN( startPoint.x(), w->x() ),
QMIN( startPoint.y(), w->y() ) );
geometries.insert( w, QRect( w->pos(), w->size() ) );
// Change the Z-order, as saving/loading uses the Z-order for
// writing/creating widgets and this has to be the same as in
// the layout. Else saving + loading will give different results
w->raise();
}
}
示例6: switch
QVariant KConfigBase::readPropertyEntry(const char *pKey, const QVariant &aDefault) const
{
if(!hasKey(pKey))
return aDefault;
QVariant tmp = aDefault;
switch(aDefault.type())
{
case QVariant::Invalid:
return QVariant();
case QVariant::String:
return QVariant(readEntry(pKey, aDefault.toString()));
case QVariant::StringList:
return QVariant(readListEntry(pKey));
case QVariant::List:
{
QStringList strList = readListEntry(pKey);
QStringList::ConstIterator it = strList.begin();
QStringList::ConstIterator end = strList.end();
QValueList< QVariant > list;
for(; it != end; ++it)
{
tmp = *it;
list.append(tmp);
}
return QVariant(list);
}
case QVariant::Font:
return QVariant(readFontEntry(pKey, &tmp.asFont()));
case QVariant::Point:
return QVariant(readPointEntry(pKey, &tmp.asPoint()));
case QVariant::Rect:
return QVariant(readRectEntry(pKey, &tmp.asRect()));
case QVariant::Size:
return QVariant(readSizeEntry(pKey, &tmp.asSize()));
case QVariant::Color:
return QVariant(readColorEntry(pKey, &tmp.asColor()));
case QVariant::Int:
return QVariant(readNumEntry(pKey, aDefault.toInt()));
case QVariant::UInt:
return QVariant(readUnsignedNumEntry(pKey, aDefault.toUInt()));
case QVariant::LongLong:
return QVariant(readNum64Entry(pKey, aDefault.toLongLong()));
case QVariant::ULongLong:
return QVariant(readUnsignedNum64Entry(pKey, aDefault.toULongLong()));
case QVariant::Bool:
return QVariant(readBoolEntry(pKey, aDefault.toBool()), 0);
case QVariant::Double:
return QVariant(readDoubleNumEntry(pKey, aDefault.toDouble()));
case QVariant::DateTime:
return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime()));
case QVariant::Date:
return QVariant(readDateTimeEntry(pKey, &tmp.asDateTime()).date());
case QVariant::Pixmap:
case QVariant::Image:
case QVariant::Brush:
case QVariant::Palette:
case QVariant::ColorGroup:
case QVariant::Map:
case QVariant::IconSet:
case QVariant::CString:
case QVariant::PointArray:
case QVariant::Region:
case QVariant::Bitmap:
case QVariant::Cursor:
case QVariant::SizePolicy:
case QVariant::Time:
case QVariant::ByteArray:
case QVariant::BitArray:
case QVariant::KeySequence:
case QVariant::Pen:
break;
}
Q_ASSERT(0);
return QVariant();
}
示例7: MYMONEYEXCEPTION
void TransactionMatcher::match(MyMoneyTransaction tm, MyMoneySplit sm, MyMoneyTransaction ti, MyMoneySplit si, bool allowImportedTransactions)
{
const MyMoneySecurity& sec = MyMoneyFile::instance()->security(m_account.currencyId());
// Now match the transactions.
//
// 'Matching' the transactions entails DELETING the end transaction,
// and MODIFYING the start transaction as needed.
//
// There are a variety of ways that a transaction can conflict.
// Post date, splits, amount are the ones that seem to matter.
// TODO: Handle these conflicts intelligently, at least warning
// the user, or better yet letting the user choose which to use.
//
// For now, we will just use the transaction details from the start
// transaction. The only thing we'll take from the end transaction
// are the bank ID's.
//
// What we have to do here is iterate over the splits in the end
// transaction, and find the corresponding split in the start
// transaction. If there is a bankID in the end split but not the
// start split, add it to the start split. If there is a bankID
// in BOTH, then this transaction cannot be merged (both transactions
// were imported!!) If the corresponding start split cannot be
// found and the end split has a bankID, we should probably just fail.
// Although we could ADD it to the transaction.
// ipwizard: Don't know if iterating over the transactions is a good idea.
// In case of a split transaction recorded with KMyMoney and the transaction
// data being imported consisting only of a single category assignment, this
// does not make much sense. The same applies for investment transactions
// stored in KMyMoney against imported transactions. I think a better solution
// is to just base the match on the splits referencing the same (currently
// selected) account.
// verify, that tm is a manually (non-matched) transaction and ti an imported one
if(sm.isMatched() || (!allowImportedTransactions && tm.isImported()))
throw new MYMONEYEXCEPTION(i18n("First transaction does not match requirement for matching"));
if(!ti.isImported())
throw new MYMONEYEXCEPTION(i18n("Second transaction does not match requirement for matching"));
// verify that the amounts are the same, otherwise we should not be matching!
if(sm.shares() != si.shares()) {
throw new MYMONEYEXCEPTION(i18n("Splits for %1 have conflicting values (%2,%3)").arg(m_account.name()).arg(sm.shares().formatMoney(m_account, sec), si.shares().formatMoney(m_account, sec)));
}
// ipwizard: I took over the code to keep the bank id found in the endMatchTransaction
// This might not work for QIF imports as they don't setup this information. It sure
// makes sense for OFX and HBCI.
const QString& bankID = si.bankID();
if (!bankID.isEmpty()) {
try {
if (sm.bankID().isEmpty() ) {
sm.setBankID( bankID );
tm.modifySplit(sm);
} else if(sm.bankID() != bankID) {
throw new MYMONEYEXCEPTION(i18n("Both of these transactions have been imported into %1. Therefore they cannot be matched. Matching works with one imported transaction and one non-imported transaction.").arg(m_account.name()));
}
} catch(MyMoneyException *e) {
QString estr = e->what();
delete e;
throw new MYMONEYEXCEPTION(i18n("Unable to match all splits (%1)").arg(estr));
}
}
#if 0 // Ace's original code
// TODO (Ace) Add in another error to catch the case where a user
// tries to match two hand-entered transactions.
QValueList<MyMoneySplit> endSplits = endMatchTransaction.splits();
QValueList<MyMoneySplit>::const_iterator it_split = endSplits.begin();
while (it_split != endSplits.end())
{
// find the corresponding split in the start transaction
MyMoneySplit startSplit;
QString accountid = (*it_split).accountId();
try
{
startSplit = startMatchTransaction.splitByAccount( accountid );
}
// only exception is thrown if we cannot find a split like this
catch(MyMoneyException *e)
{
delete e;
startSplit = (*it_split);
startSplit.clearId();
startMatchTransaction.addSplit(startSplit);
}
// verify that the amounts are the same, otherwise we should not be
// matching!
if ( (*it_split).value() != startSplit.value() )
{
QString accountname = MyMoneyFile::instance()->account(accountid).name();
throw new MYMONEYEXCEPTION(i18n("Splits for %1 have conflicting values (%2,%3)").arg(accountname).arg((*it_split).value().formatMoney(),startSplit.value().formatMoney()));
}
QString bankID = (*it_split).bankID();
if ( ! bankID.isEmpty() )
{
try
//.........这里部分代码省略.........
示例8: fitsDim
QValueList<int> fitsDim( fitsfile *fp, int HDU ) {
QValueList<int> dims;
// move to desired HDU
int ret = 0;
int hduType;
if (fits_movabs_hdu(fp, HDU, &hduType, &ret)) {
return dims;
}
// for each type of HDU, find the dimensions
int maxDim;
long rowLen;
long nRows;
int nCols;
long tbCol;
long *dimAxes = NULL;
int nAxis;
switch (hduType) {
case IMAGE_HDU:
// find the size of the image and include it in the
// generic name.
maxDim = 100; // no images should have > 100 dimensions...
dimAxes = (long*)calloc(maxDim, sizeof(long));
if (fits_read_imghdr(fp, maxDim, NULL, NULL, &nAxis, dimAxes, NULL, NULL, NULL, &ret)) {
return dims;
}
for (int i = 0; i < nAxis; i++) {
dims.append((int)dimAxes[i]);
}
free(dimAxes);
break;
case ASCII_TBL:
maxDim = 2147483646; // 2^32/2 - 2 (i.e. a big positive integer)
// find number of columns
if (fits_read_atblhdr(fp, maxDim, &rowLen, &nRows, &nCols, NULL, &tbCol, NULL, NULL, NULL, &ret)) {
return dims;
}
dims.append((int)nCols);
dims.append((int)nRows);
break;
case BINARY_TBL:
maxDim = 2147483646; // 2^32/2 - 2 (i.e. a big positive integer)
// find number of columns
if (fits_read_btblhdr(fp, maxDim, &nRows, &nCols, NULL, NULL, NULL, NULL, NULL, &ret)) {
return dims;
}
dims.append((int)nCols);
dims.append((int)nRows);
break;
default:
return dims;
break;
}
return dims;
}
示例9: kdDebug
void MakefileHandler::parse( const QString& folder, bool recursive )
{
//look for either Makefile.am.in, Makefile.am, or Makefile.in, in that order
AutoTools::ProjectAST* ast;
int ret = -1;
QString filePath = folder + "/Makefile.am.in";
if ( QFile::exists( filePath ) )
ret = AutoTools::Driver::parseFile( filePath, &ast );
else
{
filePath = folder + "/Makefile.am";
if ( QFile::exists( filePath ) )
ret = AutoTools::Driver::parseFile( filePath, &ast );
else
{
filePath = folder + "/Makefile.in";
if ( QFile::exists( filePath ) )
ret = AutoTools::Driver::parseFile( filePath, &ast );
else
kdDebug(9020) << k_funcinfo << "no appropriate file to parse in "
<< folder << endl;
}
}
if ( ret != 0 )
{
return;
}
kdDebug(9020) << k_funcinfo << filePath << " was parsed correctly. Adding information" << endl;
Q_ASSERT( ast != 0 );
d->projects[filePath] = ast;
d->folderToFileMap[folder] = filePath;
if ( recursive && ast && ast->hasChildren() )
{
QValueList<AutoTools::AST*> astChildList = ast->children();
QValueList<AutoTools::AST*>::iterator it(astChildList.begin()), clEnd(astChildList.end());
for ( ; it != clEnd; ++it )
{
if ( (*it)->nodeType() == AutoTools::AST::AssignmentAST )
{
AutoTools::AssignmentAST* assignment = static_cast<AutoTools::AssignmentAST*>( (*it) );
if ( assignment->scopedID == "SUBDIRS" )
{
QString list = assignment->values.join( QString::null );
list.simplifyWhiteSpace();
kdDebug(9020) << k_funcinfo << "subdirs is " << list << endl;
QStringList subdirList = QStringList::split( " ", list );
QStringList::iterator vit = subdirList.begin();
for ( ; vit != subdirList.end(); ++vit )
{
QString realDir = ( *vit );
if ( realDir.startsWith( "\\" ) )
realDir.remove( 0, 1 );
realDir = realDir.stripWhiteSpace();
if ( realDir != "." && realDir != ".." && !realDir.isEmpty() )
{
if ( isVariable( realDir ) )
{
kdDebug(9020) << k_funcinfo << "'" << realDir << "' is a variable" << endl;
realDir = resolveVariable( realDir, ast );
}
kdDebug(9020) << k_funcinfo << "Beginning parsing of '" << realDir << "'" << endl;
parse( folder + '/' + realDir, recursive );
}
}
}
}
}
}
}
示例10: KstDataManager
KstDataManagerI::KstDataManagerI(KstDoc *in_doc, QWidget* parent, const char* name, bool modal, WFlags fl)
: KstDataManager(parent, name, modal, fl) {
doc = in_doc;
_yesPixmap = QPixmap(locate("data", "kst/pics/yes.png"));
connect(Edit, SIGNAL(clicked()), this, SLOT(edit_I()));
connect(Delete, SIGNAL(clicked()), this, SLOT(delete_I()));
connect(Purge, SIGNAL(clicked()), doc, SLOT(purge()));
connect(DataView, SIGNAL(doubleClicked(QListViewItem *)),
this, SLOT(edit_I()));
connect(DataView, SIGNAL(currentChanged(QListViewItem *)),
this, SLOT(currentChanged(QListViewItem *)));
connect(DataView, SIGNAL(selectionChanged()),
this, SLOT(selectionChanged()));
connect(DataView, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)), this, SLOT(contextMenu(QListViewItem*, const QPoint&, int)));
_searchWidget = new KListViewSearchLineWidget(DataView, SearchBox);
QValueList<int> cols;
cols.append(0);
_searchWidget->createSearchLine(DataView);
_searchWidget->searchLine()->setSearchColumns(cols);
QMainWindow *main = static_cast<QMainWindow*>(parent);
main->setUsesTextLabel(true);
_primitive = new QToolBar(i18n("Create Primitive"), main, this);
_primitive->setFrameStyle(QFrame::NoFrame);
_primitive->setOrientation(Qt::Vertical);
_primitive->setBackgroundMode(PaletteBase);
_data = new QToolBar(i18n("Create Data Object"), main, this);
_data->setFrameStyle(QFrame::NoFrame);
_data->setOrientation(Qt::Vertical);
_data->setBackgroundMode(PaletteBase);
_plugins = new QToolBar(i18n("Create Plugin"), main, this);
_plugins->setFrameStyle(QFrame::NoFrame);
_plugins->setOrientation(Qt::Vertical);
_plugins->setBackgroundMode(PaletteBase);
_fits = new QToolBar(i18n("Create Fit"), main, this);
_fits->setFrameStyle(QFrame::NoFrame);
_fits->setOrientation(Qt::Vertical);
_fits->setBackgroundMode(PaletteBase);
_filters = new QToolBar(i18n("Create Filter"), main, this);
_filters->setFrameStyle(QFrame::NoFrame);
_filters->setOrientation(Qt::Vertical);
_filters->setBackgroundMode(PaletteBase);
ToolBox->setUpdatesEnabled(false);
_primitive->setUpdatesEnabled(false);
_primitive->clear();
_data->setUpdatesEnabled(false);
_data->clear();
_plugins->setUpdatesEnabled(false);
_plugins->clear();
_fits->setUpdatesEnabled(false);
_fits->clear();
_filters->setUpdatesEnabled(false);
_filters->clear();
//Create canonical actions...
// createObjectAction(i18n("Scalar"), _primitive, KstScalarDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Vector"), _primitive, KstVectorDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Matrix"), _primitive, KstMatrixDialogI::globalInstance(), SLOT(show()));
// createObjectAction(i18n("String"), _primitive, KstStringDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Curve"), _data, KstCurveDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Equation"), _data, KstEqDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Histogram"), _data, KstHsDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Spectrum"), _data, KstPsdDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Event Monitor"), _data, KstEventMonitorI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Image"), _data, KstImageDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Spectrogram"), _data, KstCsdDialogI::globalInstance(), SLOT(show()));
createObjectAction(i18n("Vector View"), _data, KstVvDialogI::globalInstance(), SLOT(show()));
//Create plugin actions...
setupPluginActions();
//TODO sort the actions in each box alphabetically?
QWidget *priw = new QWidget(_primitive);
priw->setBackgroundMode(PaletteBase);
_primitive->setStretchableWidget(priw);
QWidget *datw = new QWidget(_data);
datw->setBackgroundMode(PaletteBase);
_data->setStretchableWidget(datw);
QWidget *pluginw = new QWidget(_plugins);
pluginw->setBackgroundMode(PaletteBase);
_plugins->setStretchableWidget(pluginw);
//.........这里部分代码省略.........
示例11: QTime
QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDate &from,
const QDate &to )
{
QValueList<EffectiveEvent> tmpList;
QValueListIterator<Event> it;
EffectiveEvent effEv;
QDateTime dtTmp,
dtEnd;
for (it = eventList.begin(); it != eventList.end(); ++it ) {
if (!(*it).isValidUid())
(*it).assignUid(); // FIXME: Hack to restore cleared uids
dtTmp = (*it).start(TRUE);
dtEnd = (*it).end(TRUE);
if ( dtTmp.date() >= from && dtTmp.date() <= to ) {
Event tmpEv = *it;
effEv.setEvent(tmpEv);
effEv.setDate( dtTmp.date() );
effEv.setStart( dtTmp.time() );
if ( dtTmp.date() != dtEnd.date() )
effEv.setEnd( QTime(23, 59, 0) );
else
effEv.setEnd( dtEnd.time() );
tmpList.append( effEv );
}
// we must also check for end date information...
if ( dtEnd.date() != dtTmp.date() && dtEnd.date() >= from ) {
QDateTime dt = dtTmp.addDays( 1 );
dt.setTime( QTime(0, 0, 0) );
QDateTime dtStop;
if ( dtEnd > to ) {
dtStop = to;
} else
dtStop = dtEnd;
while ( dt <= dtStop ) {
Event tmpEv = *it;
effEv.setEvent( tmpEv );
effEv.setDate( dt.date() );
if ( dt >= from ) {
effEv.setStart( QTime(0, 0, 0) );
if ( dt.date() == dtEnd.date() )
effEv.setEnd( dtEnd.time() );
else
effEv.setEnd( QTime(23, 59, 59) );
tmpList.append( effEv );
}
dt = dt.addDays( 1 );
}
}
}
// check for repeating events...
QDateTime repeat;
for ( it = repeatEvents.begin(); it != repeatEvents.end(); ++it ) {
if (!(*it).isValidUid())
(*it).assignUid(); // FIXME: Hack to restore cleared uids
/* create a false end date, to short circuit on hard
MonthlyDay recurences */
Event dummy_event = *it;
int duration = (*it).start().date().daysTo( (*it).end().date() );
QDate itDate = from.addDays(-duration);
Event::RepeatPattern r = dummy_event.repeatPattern();
if ( !r.hasEndDate || r.endDate() > to ) {
r.setEndDate( to );
r.hasEndDate = TRUE;
}
dummy_event.setRepeat(TRUE, r);
while (nextOccurance(dummy_event, itDate, repeat)) {
if(repeat.date() > to)
break;
effEv.setDate( repeat.date() );
if ((*it).type() == Event::AllDay) {
effEv.setStart( QTime(0,0,0) );
effEv.setEnd( QTime(23,59,59) );
} else {
/* we only occur by days, not hours/minutes/seconds. Hence
the actual end and start times will be the same for
every repeated event. For multi day events this is
fixed up later if on wronge day span */
effEv.setStart( (*it).start().time() );
effEv.setEnd( (*it).end().time() );
}
if ( duration != 0 ) {
// multi-day repeating events
QDate sub_it = QMAX( repeat.date(), from );
QDate startDate = repeat.date();
QDate endDate = startDate.addDays( duration );
while ( sub_it <= endDate && sub_it <= to ) {
EffectiveEvent tmpEffEv = effEv;
Event tmpEv = *it;
tmpEffEv.setEvent( tmpEv );
if ( sub_it != startDate )
tmpEffEv.setStart( QTime(0,0,0) );
//.........这里部分代码省略.........
示例12: QRegion
/**
Internal method that draws one of the pies in a pie chart.
\param painter the QPainter to draw in
\param dataset the dataset to draw the pie for
\param pie the pie to draw
\param the chart to draw the pie in
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
void KDChartPiePainter::drawOnePie( QPainter* painter,
KDChartTableDataBase* /*data*/,
uint dataset, uint pie, uint chart,
uint threeDPieHeight,
KDChartDataRegionList* regions )
{
// Is there anything to draw at all?
int angleLen = _angleLens[ ( int ) pie ];
if ( angleLen ) {
int startAngle = _startAngles[ ( int ) pie ];
KDChartDataRegion* datReg = 0;
QRegion* region = 0;
bool mustDeleteRegion = false;
if ( regions ){
region = new QRegion();
mustDeleteRegion = true;
}
QRect drawPosition = _position;
if ( params()->explode() ) {
// need to compute a new position for each or some of the pie
QValueList<int> explodeList = params()->explodeValues();
if( explodeList.count() == 0 || // nothing on list, explode all
explodeList.find( pie ) != explodeList.end() ) {
double explodeAngle = ( startAngle + angleLen / 2 ) / 16;
double explodeAngleRad = DEGTORAD( explodeAngle );
double cosAngle = cos( explodeAngleRad );
double sinAngle = -sin( explodeAngleRad );
// find the explode factor for this particular pie
double explodeFactor = 0.0;
QMap<int,double> explodeFactors = params()->explodeFactors();
if( !explodeFactors.contains( pie ) ) // not on factors list, use default
explodeFactor = params()->explodeFactor();
else // on factors list, use segment-specific value
explodeFactor = explodeFactors[pie];
double explodeX = explodeFactor * _size * cosAngle;
double explodeY = explodeFactor * _size * sinAngle;
drawPosition.moveBy( static_cast<int>( explodeX ), static_cast<int>( explodeY ) );
} else
drawPosition = _position;
} else
drawPosition = _position;
// The 3D effect needs to be drawn first because it could
// otherwise partly hide the pie itself.
if ( params()->threeDPies() ) {
draw3DEffect( painter, drawPosition, dataset, pie, chart,
threeDPieHeight,
params()->explode(), region );
}
painter->setBrush( params()->dataColor( pie ) );
if ( angleLen == 5760 ) {
// full circle, avoid nasty line in the middle
painter->drawEllipse( drawPosition );
if ( regions ) {
QPointArray hitregion;
hitregion.makeEllipse( drawPosition.x(), drawPosition.y(),
drawPosition.width(),
drawPosition.height() );
datReg = new KDChartDataRegion( region->unite( QRegion( hitregion ) ),
dataset,
pie,
chart );
datReg->points[ KDChartEnums::PosCenter ]
= drawPosition.center();
datReg->points[ KDChartEnums::PosCenterRight ]
= pointOnCircle( drawPosition, 0 );
datReg->points[ KDChartEnums::PosTopRight ]
= pointOnCircle( drawPosition, 720 );
datReg->points[ KDChartEnums::PosTopCenter ]
= pointOnCircle( drawPosition, 1440 );
datReg->points[ KDChartEnums::PosTopLeft ]
= pointOnCircle( drawPosition, 2160 );
datReg->points[ KDChartEnums::PosCenterLeft ]
= pointOnCircle( drawPosition, 2880 );
datReg->points[ KDChartEnums::PosBottomLeft ]
= pointOnCircle( drawPosition, 3600 );
datReg->points[ KDChartEnums::PosBottomCenter ]
= pointOnCircle( drawPosition, 4320 );
datReg->points[ KDChartEnums::PosBottomRight ]
= pointOnCircle( drawPosition, 5040 );
datReg->startAngle = 2880;
datReg->angleLen = 5760;
regions->append( datReg );
}
} else {
//.........这里部分代码省略.........
示例13: lookupLocalized
void LayoutConfig::save()
{
QString model = lookupLocalized(m_rules->models(), widget->comboModel->currentText());
m_kxkbConfig.m_model = model;
m_kxkbConfig.m_enableXkbOptions = widget->chkEnableOptions->isChecked();
m_kxkbConfig.m_resetOldOptions = widget->checkResetOld->isChecked();
m_kxkbConfig.m_options = createOptionString();
QListViewItem *item = widget->listLayoutsDst->firstChild();
QValueList< LayoutUnit > layouts;
while(item)
{
QString layout = item->text(LAYOUT_COLUMN_MAP);
QString variant = item->text(LAYOUT_COLUMN_VARIANT);
QString includes = item->text(LAYOUT_COLUMN_INCLUDE);
QString displayName = item->text(LAYOUT_COLUMN_DISPLAY_NAME);
LayoutUnit layoutUnit(layout, variant);
layoutUnit.includeGroup = includes;
layoutUnit.displayName = displayName;
layouts.append(layoutUnit);
item = item->nextSibling();
kdDebug() << "To save: layout " << layoutUnit.toPair() << ", inc: " << layoutUnit.includeGroup << ", disp: " << layoutUnit.displayName
<< endl;
}
m_kxkbConfig.m_layouts = layouts;
if(m_kxkbConfig.m_layouts.count() == 0)
{
m_kxkbConfig.m_layouts.append(LayoutUnit(DEFAULT_LAYOUT_UNIT));
widget->chkEnable->setChecked(false);
}
m_kxkbConfig.m_useKxkb = widget->chkEnable->isChecked();
m_kxkbConfig.m_showSingle = widget->chkShowSingle->isChecked();
m_kxkbConfig.m_showFlag = widget->chkShowFlag->isChecked();
int modeId = widget->grpSwitching->id(widget->grpSwitching->selected());
switch(modeId)
{
default:
case 0:
m_kxkbConfig.m_switchingPolicy = SWITCH_POLICY_GLOBAL;
break;
case 1:
m_kxkbConfig.m_switchingPolicy = SWITCH_POLICY_WIN_CLASS;
break;
case 2:
m_kxkbConfig.m_switchingPolicy = SWITCH_POLICY_WINDOW;
break;
}
m_kxkbConfig.m_stickySwitching = widget->chkEnableSticky->isChecked();
m_kxkbConfig.m_stickySwitchingDepth = widget->spinStickyDepth->value();
m_kxkbConfig.save();
kapp->kdeinitExec("kxkb");
emit KCModule::changed(false);
}
示例14: ourClipRect
//.........这里部分代码省略.........
}
// If there was no value at all, bail out, to avoid endless loops
// later on (e.g. in findPieAt()).
if( !atLeastOneValue )
return;
// Find the backmost pie which is at +90° and needs to be drawn
// first
int backmostpie = findPieAt( 90 * 16 );
// Find the frontmost pie (at -90°/+270°) that should be drawn last
int frontmostpie = findPieAt( 270 * 16 );
// and put the backmost pie on the TODO stack to initialize it,
// but only if it is not the frontmostpie
QValueStack < int > todostack;
if ( backmostpie != frontmostpie )
todostack.push( backmostpie );
else {
// Otherwise, try to find something else
int leftOfCurrent = findLeftPie( backmostpie );
if ( leftOfCurrent != frontmostpie ) {
todostack.push( leftOfCurrent );
} else {
int rightOfCurrent = findRightPie( backmostpie );
if ( rightOfCurrent != frontmostpie ) {
todostack.push( rightOfCurrent );
}
}
// If we get here, there was nothing else, and we will bail
// out of the while loop below.
}
// The list with pies that have already been drawn
QValueList < int > donelist;
// Draw pies until the todostack is empty or only the frontmost
// pie is there
while ( !todostack.isEmpty() &&
!( ( todostack.count() == 1 ) &&
( ( todostack.top() == frontmostpie ) ) ) ) {
// The while loop cannot be cancelled if frontmostpie is on
// top of the stack, but this is also backmostpie (can happen
// when one of the pies covers more than 1/2 of the circle. In
// this case, we need to find something else to put on the
// stack to get things going.
// take one pie from the stack
int currentpie = todostack.pop();
// if this pie was already drawn, ignore it
if ( donelist.find( currentpie ) != donelist.end() )
continue;
// If this pie is the frontmost pie, put it back, but at the
// second position (otherwise, there would be an endless
// loop). If this pie is the frontmost pie, there must be at
// least one other pie, otherwise the loop would already have
// been terminated by the loop condition.
if ( currentpie == frontmostpie ) {
Q_ASSERT( !todostack.isEmpty() );
// QValueStack::exchange() would be nice here...
int secondpie = todostack.pop();
if ( currentpie == secondpie )
// no need to have the second pie twice on the stack,
// forget about one instance and take the third
// instead
if ( todostack.isEmpty() )
break; // done anyway
else
secondpie = todostack.pop();
todostack.push( currentpie );
todostack.push( secondpie );
continue;
}
// When we get here, we can just draw the pie and proceed.
drawOnePie( painter, data, dataset, currentpie, chart,
sizeFor3DEffect,
regions );
// Mark the pie just drawn as done.
donelist.append( currentpie );
// Now take the pie to the left and to the right, check
// whether these have not been painted already, and put them
// on the stack.
int leftOfCurrent = findLeftPie( currentpie );
if ( donelist.find( leftOfCurrent ) == donelist.end() )
todostack.push( leftOfCurrent );
int rightOfCurrent = findRightPie( currentpie );
if ( donelist.find( rightOfCurrent ) == donelist.end() )
todostack.push( rightOfCurrent );
}
// now only the frontmost pie is left to draw
drawOnePie( painter, data, dataset, frontmostpie, chart,
sizeFor3DEffect,
regions );
}
示例15: switch
//.........这里部分代码省略.........
return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL);
return new CSSPrimitiveValueImpl(style->zIndex(), CSSPrimitiveValue::CSS_NUMBER);
case CSS_PROP_BACKGROUND:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER_COLOR:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER_STYLE:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER_TOP:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER_RIGHT:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER_BOTTOM:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER_LEFT:
// FIXME: unimplemented
break;
case CSS_PROP_BORDER_WIDTH:
// FIXME: unimplemented
break;
case CSS_PROP_FONT:
// FIXME: unimplemented
break;
case CSS_PROP_LIST_STYLE:
// FIXME: unimplemented
break;
case CSS_PROP_MARGIN:
// FIXME: unimplemented
break;
case CSS_PROP_OUTLINE:
// FIXME: unimplemented
break;
case CSS_PROP_PADDING:
// FIXME: unimplemented
break;
#if !APPLE_CHANGES
case CSS_PROP_SCROLLBAR_FACE_COLOR:
// FIXME: unimplemented
break;
case CSS_PROP_SCROLLBAR_SHADOW_COLOR:
// FIXME: unimplemented
break;
case CSS_PROP_SCROLLBAR_HIGHLIGHT_COLOR:
// FIXME: unimplemented
break;
case CSS_PROP_SCROLLBAR_3DLIGHT_COLOR:
// FIXME: unimplemented
break;
case CSS_PROP_SCROLLBAR_DARKSHADOW_COLOR:
// FIXME: unimplemented
break;
case CSS_PROP_SCROLLBAR_TRACK_COLOR:
// FIXME: unimplemented
break;
case CSS_PROP_SCROLLBAR_ARROW_COLOR:
// FIXME: unimplemented
break;
#endif
#if APPLE_CHANGES
case CSS_PROP__APPLE_DASHBOARD_REGION: {
QValueList<StyleDashboardRegion> regions = style->dashboardRegions();
uint i, count = regions.count();
if (count == 1 && regions[0].type == StyleDashboardRegion::None)
return new CSSPrimitiveValueImpl (CSS_VAL_NONE);
DashboardRegionImpl *firstRegion = new DashboardRegionImpl(), *region;
region = firstRegion;
for (i = 0; i < count; i++) {
StyleDashboardRegion styleRegion = regions[i];
region->m_label = styleRegion.label;
LengthBox offset = styleRegion.offset;
region->setTop (new CSSPrimitiveValueImpl(offset.top.value, CSSPrimitiveValue::CSS_PX));
region->setRight (new CSSPrimitiveValueImpl(offset.right.value, CSSPrimitiveValue::CSS_PX));
region->setBottom (new CSSPrimitiveValueImpl(offset.bottom.value, CSSPrimitiveValue::CSS_PX));
region->setLeft (new CSSPrimitiveValueImpl(offset.left.value, CSSPrimitiveValue::CSS_PX));
region->m_isRectangle = (styleRegion.type == StyleDashboardRegion::Rectangle);
region->m_isCircle = (styleRegion.type == StyleDashboardRegion::Circle);
if (i != count-1) {
DashboardRegionImpl *newRegion = new DashboardRegionImpl();
region->setNext (newRegion);
region = newRegion;
}
}
return new CSSPrimitiveValueImpl(firstRegion);
}
#endif
}
ERROR("unimplemented propertyID: %d", propertyID);
return 0;
}