本文整理汇总了C++中QCString::toInt方法的典型用法代码示例。如果您正苦于以下问题:C++ QCString::toInt方法的具体用法?C++ QCString::toInt怎么用?C++ QCString::toInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCString
的用法示例。
在下文中一共展示了QCString::toInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateInstance
void Small::updateInstance(int no, QCString value)
{
bool checked = false;
switch(no){
case 0:
w->textLabel10->setText(value);
break;
case 1:
w->textLabel11->setText(value);
break;
case 2:
w->textLabel12->setText(value);
if(value == "ENABLED")
checked = true;
w->checkBox2 ->setChecked(checked);
checked=false;
break;
case 3:
w->textLabel13->setText(value);
break;
case 4:
w->textLabel14->setText(value);
break;
case 5:
w->textLabel15->setText(value);
break;
case 6:
w->spinBox2->setSpecialValueText(value);
break;
case 7:
w->spinBox3->setSpecialValueText(value);
break;
case 8:
if(value == "YES")
checked = true;
w->checkBox1->setChecked(checked);
checked=false;
break;
case 9:
w->comboBox1->setCurrentItem(value.toInt());
break;
case 10:
// w->spinBox5->setSpecialValueText(value);
w->slider2->setValue(value.toInt());
case 11:
if(value == "YES")
checked = true;
// w->checkBox2->setChecked(checked);
checked=false;
break;
default:
break;
}
}
示例2: startLocation
void MemberHandler::startLocation(const QXmlAttributes& attrib)
{
m_defFile = attrib.value("file");
QCString s;
s = attrib.value("line");
if (!s.isEmpty()) m_defLine=s.toInt();
s = attrib.value("bodystart");
if (!s.isEmpty()) m_bodyStart=s.toInt();
s = attrib.value("bodyend");
if (!s.isEmpty()) m_bodyEnd=s.toInt();
}
示例3: readNumEntry
int KConfigBase::readNumEntry(const char *pKey, int nDefault) const
{
QCString aValue = readEntryUtf8(pKey);
if(aValue.isNull())
return nDefault;
else if(aValue == "true" || aValue == "on" || aValue == "yes")
return 1;
else
{
bool ok;
int rc = aValue.toInt(&ok);
return (ok ? rc : nDefault);
}
}
示例4: readBoolEntry
bool KConfigBase::readBoolEntry(const char *pKey, bool bDefault) const
{
QCString aValue = readEntryUtf8(pKey);
if(aValue.isNull())
return bDefault;
else
{
if(aValue == "true" || aValue == "on" || aValue == "yes" || aValue == "1")
return true;
else
{
bool bOK;
int val = aValue.toInt(&bOK);
if(bOK && val != 0)
return true;
else
return false;
}
}
}
示例5: startApp
static int startApp()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
// Stop daemon and exit?
if (args->isSet("s"))
{
KDEsuClient client;
if (client.ping() == -1)
{
kdError(1206) << "Daemon not running -- nothing to stop\n";
exit(1);
}
if (client.stopServer() != -1)
{
kdDebug(1206) << "Daemon stopped\n";
exit(0);
}
kdError(1206) << "Could not stop daemon\n";
exit(1);
}
QString icon;
if ( args->isSet("i"))
icon = args->getOption("i");
bool prompt = true;
if ( args->isSet("d"))
prompt = false;
// Get target uid
QCString user = args->getOption("u");
QCString auth_user = user;
struct passwd *pw = getpwnam(user);
if (pw == 0L)
{
kdError(1206) << "User " << user << " does not exist\n";
exit(1);
}
bool change_uid = (getuid() != pw->pw_uid);
// If file is writeable, do not change uid
QString file = QFile::decodeName(args->getOption("f"));
if (change_uid && !file.isEmpty())
{
if (file.at(0) != '/')
{
KStandardDirs dirs;
dirs.addKDEDefaults();
file = dirs.findResource("config", file);
if (file.isEmpty())
{
kdError(1206) << "Config file not found: " << file << "\n";
exit(1);
}
}
QFileInfo fi(file);
if (!fi.exists())
{
kdError(1206) << "File does not exist: " << file << "\n";
exit(1);
}
change_uid = !fi.isWritable();
}
// Get priority/scheduler
QCString tmp = args->getOption("p");
bool ok;
int priority = tmp.toInt(&ok);
if (!ok || (priority < 0) || (priority > 100))
{
KCmdLineArgs::usage(i18n("Illegal priority: %1").arg(tmp));
exit(1);
}
int scheduler = SuProcess::SchedNormal;
if (args->isSet("r"))
scheduler = SuProcess::SchedRealtime;
if ((priority > 50) || (scheduler != SuProcess::SchedNormal))
{
change_uid = true;
auth_user = "root";
}
// Get command
if (args->isSet("c"))
{
command = args->getOption("c");
for (int i=0; i<args->count(); i++)
{
QString arg = QFile::decodeName(args->arg(i));
KRun::shellQuote(arg);
command += " ";
command += QFile::encodeName(arg);
}
}
else
{
if( args->count() == 0 )
{
KCmdLineArgs::usage(i18n("No command specified."));
exit(1);
//.........这里部分代码省略.........
示例6: start
bool KoApplication::start()
{
ResetStarting resetStarting; // reset m_starting to false when we're done
Q_UNUSED( resetStarting );
// Find the *.desktop file corresponding to the kapp instance name
KoDocumentEntry entry = KoDocumentEntry( KoDocument::readNativeService() );
if ( entry.isEmpty() )
{
kdError( 30003 ) << instanceName() << "part.desktop not found." << endl;
kdError( 30003 ) << "Run 'kde-config --path services' to see which directories were searched, assuming kde startup had the same environment as your current shell." << endl;
kdError( 30003 ) << "Check your installation (did you install KOffice in a different prefix than KDE, without adding the prefix to /etc/kderc ?)" << endl;
return false;
}
// Get the command line arguments which we have to parse
KCmdLineArgs *args= KCmdLineArgs::parsedArgs();
int argsCount = args->count();
KCmdLineArgs *koargs = KCmdLineArgs::parsedArgs("koffice");
QCString dpiValues = koargs->getOption( "dpi" );
if ( !dpiValues.isEmpty() ) {
int sep = dpiValues.find( QRegExp( "[x, ]" ) );
int dpiX;
int dpiY = 0;
bool ok = true;
if ( sep != -1 ) {
dpiY = dpiValues.mid( sep+1 ).toInt( &ok );
dpiValues.truncate( sep );
}
if ( ok ) {
dpiX = dpiValues.toInt( &ok );
if ( ok ) {
if ( !dpiY ) dpiY = dpiX;
KoGlobal::setDPI( dpiX, dpiY );
}
}
}
// No argument -> create an empty document
if ( !argsCount ) {
KoDocument* doc = entry.createDoc( 0, "Document" );
if ( !doc )
return false;
KoMainWindow *shell = new KoMainWindow( doc->instance() );
shell->show();
QObject::connect(doc, SIGNAL(sigProgress(int)), shell, SLOT(slotProgress(int)));
// for initDoc to fill in the recent docs list
// and for KoDocument::slotStarted
doc->addShell( shell );
if ( doc->checkAutoSaveFile() ) {
shell->setRootDocument( doc );
} else {
doc->showStartUpWidget( shell );
}
// FIXME This needs to be moved someplace else
QObject::disconnect(doc, SIGNAL(sigProgress(int)), shell, SLOT(slotProgress(int)));
} else {
bool print = koargs->isSet("print");
bool doTemplate = koargs->isSet("template");
koargs->clear();
// Loop through arguments
short int n=0; // number of documents open
short int nPrinted = 0;
for(int i=0; i < argsCount; i++ )
{
// For now create an empty document
KoDocument* doc = entry.createDoc( 0 );
if ( doc )
{
// show a shell asap
KoMainWindow *shell = new KoMainWindow( doc->instance() );
if (!print)
shell->show();
// are we just trying to open a template?
if ( doTemplate ) {
QStringList paths;
if ( args->url(i).isLocalFile() && QFile::exists(args->url(i).path()) )
{
paths << QString(args->url(i).path());
kdDebug(30003) << "using full path..." << endl;
} else {
QString desktopName(args->arg(i));
QString appName = KGlobal::instance()->instanceName();
paths = KGlobal::dirs()->findAllResources("data", appName +"/templates/*/" + desktopName );
if ( paths.isEmpty()) {
paths = KGlobal::dirs()->findAllResources("data", appName +"/templates/" + desktopName );
}
if ( paths.isEmpty()) {
KMessageBox::error(0L, i18n("No template found for: %1 ").arg(desktopName) );
delete shell;
} else if ( paths.count() > 1 ) {
KMessageBox::error(0L, i18n("Too many templates found for: %1").arg(desktopName) );
delete shell;
}
//.........这里部分代码省略.........