本文整理汇总了C++中QString::arg方法的典型用法代码示例。如果您正苦于以下问题:C++ QString::arg方法的具体用法?C++ QString::arg怎么用?C++ QString::arg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::arg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: singleFit
void IqtFit::singleFit() {
if (!validate())
return;
// Don't plot a new guess curve until there is a fit
disconnect(m_dblManager, SIGNAL(propertyChanged(QtProperty *)), this,
SLOT(plotGuess(QtProperty *)));
// First create the function
auto function = createFunction();
const int fitType = m_uiForm.cbFitType->currentIndex();
if (m_uiForm.ckConstrainIntensities->isChecked()) {
switch (fitType) {
case 0: // 1 Exp
case 2: // 1 Str
m_ties = "f1.Intensity = 1-f0.A0";
break;
case 1: // 2 Exp
case 3: // 1 Exp & 1 Str
m_ties = "f1.Intensity=1-f2.Intensity-f0.A0";
break;
default:
break;
}
}
QString ftype = fitTypeString();
updatePlot();
if (m_ffInputWS == NULL) {
return;
}
QString pyInput =
"from IndirectCommon import getWSprefix\nprint getWSprefix('%1')\n";
pyInput = pyInput.arg(m_ffInputWSName);
m_singleFitOutputName = runPythonCode(pyInput).trimmed() + QString("fury_") +
ftype + m_uiForm.spPlotSpectrum->text();
// Create the Fit Algorithm
m_singleFitAlg = AlgorithmManager::Instance().create("Fit");
m_singleFitAlg->initialize();
m_singleFitAlg->setPropertyValue("Function", function->asString());
m_singleFitAlg->setPropertyValue("InputWorkspace",
m_ffInputWSName.toStdString());
m_singleFitAlg->setProperty("WorkspaceIndex",
m_uiForm.spPlotSpectrum->text().toInt());
m_singleFitAlg->setProperty("StartX",
m_ffRangeManager->value(m_properties["StartX"]));
m_singleFitAlg->setProperty("EndX",
m_ffRangeManager->value(m_properties["EndX"]));
m_singleFitAlg->setProperty(
"MaxIterations",
static_cast<int>(m_dblManager->value(m_properties["MaxIterations"])));
m_singleFitAlg->setProperty(
"Minimizer", minimizerString(m_singleFitOutputName).toStdString());
m_singleFitAlg->setProperty("Ties", m_ties.toStdString());
m_singleFitAlg->setPropertyValue("Output",
m_singleFitOutputName.toStdString());
connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this,
SLOT(singleFitComplete(bool)));
m_batchAlgoRunner->addAlgorithm(m_singleFitAlg);
m_batchAlgoRunner->executeBatchAsync();
}
示例2: dstCalc
tSunMoonDialog::tSunMoonDialog( tMCoord Position, QDateTime Date, QWidget* pParent )
: tDialog( tDialog::Full, pParent ),
m_Date( Date ),
m_Position( Position )
{
//JR 2/17/10, NSW-4850, append the GMT offset to the title
QString titleAppend;
tDSTCalculator dstCalc(tPath::GMTDataDir(), m_Position.X(), m_Position.Y(), false);
tDSTResults results;
if(dstCalc.CalculateDST(QDateTime(), results, false, true, false, true))
{
int minutes_offset = tSystemSettings::Instance()->LocalTimeOffset();
bool negative_offset = minutes_offset < 0;
minutes_offset = negative_offset ? -minutes_offset : minutes_offset;
int hours_offset = minutes_offset / 60;
minutes_offset -= hours_offset * 60;
titleAppend = " (GMT %1%2:%3)";
titleAppend = titleAppend.arg(negative_offset?QString("-"):QString("")).arg(hours_offset, 1, 10, QChar('0')).arg(minutes_offset, 2, 10, QChar('0'));
}
else
{
titleAppend = " (LST)";
}
setWindowTitle( tr( "Sun and Moon", "[title]" ) + titleAppend);
m_pMoonRiseTime = new QLabel( this );
m_pMoonSetTime = new QLabel( this );
m_pMoonPhase = new QLabel( this );
m_pSunRiseTime = new QLabel( this );
m_pSunSetTime = new QLabel( this );
RunCalculations();
// grab the sun and moon images
QPixmap moonPixmap( tPath::ResourceFile("moon.PNG") );
QPixmap sunPixmap( tPath::ResourceFile("sun.PNG") );
if( tProductSettings::Instance().ScreenPixelWidth() <= 640 )
{
moonPixmap = moonPixmap.scaledToWidth( moonPixmap.width() * 3 / 4, Qt::SmoothTransformation );
sunPixmap = sunPixmap.scaledToWidth( sunPixmap.width() * 3 / 4, Qt::SmoothTransformation );
}
ProcessMoonPixmap( moonPixmap );
// make the moon info
QLabel* pMoonRiseTitle = new QLabel( tr( "Rise", "Moon Rise" ), this );
QLabel* pMoonSetTitle = new QLabel( tr( "Set", "Moon Set" ), this );
QLabel* pMoonPhaseTitle = new QLabel( tr( "Phase", "Moon Phase" ), this );
QFrame* pMoonFrame = new QFrame( this );
m_pMoonImage = new QLabel( this );
m_pMoonImage->setPixmap( moonPixmap );
pMoonFrame->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
pMoonFrame->setLineWidth( 1 );
// lay out the moon items
QGridLayout* moonDataLayout = new QGridLayout();
moonDataLayout->setContentsMargins( 0, 0, 0, 0 );
moonDataLayout->setHorizontalSpacing( 10 );
moonDataLayout->setVerticalSpacing( 0 );
moonDataLayout->setColumnStretch( 0, 1 );
moonDataLayout->setRowMinimumHeight( 0, moonPixmap.height() / 2 );
moonDataLayout->setRowStretch( 1, 1 );
moonDataLayout->addWidget( pMoonRiseTitle, 2, 1 );
moonDataLayout->addWidget( m_pMoonRiseTime, 2, 2 );
moonDataLayout->addWidget( pMoonSetTitle, 3, 1 );
moonDataLayout->addWidget( m_pMoonSetTime, 3, 2 );
moonDataLayout->addWidget( pMoonPhaseTitle, 4, 1 );
moonDataLayout->addWidget( m_pMoonPhase, 4, 2 );
moonDataLayout->setRowStretch( 5, 1 );
moonDataLayout->setColumnStretch( 3, 1 );
pMoonFrame->setLayout( moonDataLayout );
QGridLayout* moonLayout = new QGridLayout();
moonLayout->setContentsMargins( 0, 0, 0, 0 );
moonLayout->addWidget( m_pMoonImage, 0, 0, 2, 1, Qt::AlignCenter );
moonLayout->addWidget( pMoonFrame, 1, 0, 2, 1 );
moonLayout->setRowMinimumHeight( 0, moonPixmap.height() / 2 );
// make the sun info
QLabel* pSunRiseTitle = new QLabel( tr( "Rise", "Sun Rise" ), this );
QLabel* pSunSetTitle = new QLabel( tr( "Set", "Sun Set" ), this );
QLabel* pSunImage = new QLabel( this );
pSunImage->setPixmap( sunPixmap );
QFrame* pSunFrame = new QFrame( this );
pSunFrame->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
pSunFrame->setLineWidth( 1 );
// lay out the sun items
QGridLayout* sunDataLayout = new QGridLayout();
sunDataLayout->setContentsMargins( 0, 0, 0, 0 );
sunDataLayout->setHorizontalSpacing( 10 );
sunDataLayout->setVerticalSpacing( 0 );
sunDataLayout->setColumnStretch( 0, 1 );
sunDataLayout->setRowMinimumHeight( 0, sunPixmap.height() / 2 );
sunDataLayout->setRowStretch( 1, 1 );
sunDataLayout->addWidget( pSunRiseTitle, 2, 1 );
sunDataLayout->addWidget( m_pSunRiseTime, 2, 2 );
sunDataLayout->addWidget( pSunSetTitle, 3, 1 );
sunDataLayout->addWidget( m_pSunSetTime, 3, 2 );
sunDataLayout->setRowStretch( 4, 1 );
//.........这里部分代码省略.........
示例3: reset
void SeasideCache::reset()
{
for (int i = 0; i < FilterTypesCount; ++i) {
m_contacts[i].clear();
m_populated[i] = false;
m_models[i] = 0;
}
m_cache.clear();
#ifdef USING_QTPIM
m_cacheIndices.clear();
#endif
for (uint i = 0; i < sizeof(contactsData) / sizeof(Contact); ++i) {
QContact contact;
#ifdef USING_QTPIM
// This is specific to the qtcontacts-sqlite backend:
const QString idStr(QString::fromLatin1("qtcontacts:org.nemomobile.contacts.sqlite::sql-%1"));
contact.setId(QContactId::fromString(idStr.arg(i + 1)));
#else
QContactId contactId;
contactId.setLocalId(i + 1);
contact.setId(contactId);
#endif
QContactName name;
name.setFirstName(QLatin1String(contactsData[i].firstName));
name.setLastName(QLatin1String(contactsData[i].lastName));
contact.saveDetail(&name);
if (contactsData[i].avatar) {
QContactAvatar avatar;
avatar.setImageUrl(QUrl(QLatin1String(contactsData[i].avatar)));
contact.saveDetail(&avatar);
}
QContactStatusFlags statusFlags;
if (contactsData[i].email) {
QContactEmailAddress email;
email.setEmailAddress(QLatin1String(contactsData[i].email));
contact.saveDetail(&email);
statusFlags.setFlag(QContactStatusFlags::HasEmailAddress, true);
}
if (contactsData[i].phoneNumber) {
QContactPhoneNumber phoneNumber;
phoneNumber.setNumber(QLatin1String(contactsData[i].phoneNumber));
contact.saveDetail(&phoneNumber);
statusFlags.setFlag(QContactStatusFlags::HasPhoneNumber, true);
}
contact.saveDetail(&statusFlags);
#ifdef USING_QTPIM
m_cacheIndices.insert(internalId(contact), m_cache.count());
#endif
m_cache.append(CacheItem(contact));
QString fullName = name.firstName() + QChar::fromLatin1(' ') + name.lastName();
CacheItem &cacheItem = m_cache.last();
cacheItem.nameGroup = determineNameGroup(&cacheItem);
cacheItem.displayLabel = fullName;
}
insert(FilterAll, 0, getContactsForFilterType(FilterAll));
insert(FilterFavorites, 0, getContactsForFilterType(FilterFavorites));
insert(FilterOnline, 0, getContactsForFilterType(FilterOnline));
}
示例4: adjustChannelPoints
void VnaTimeDomain::adjustChannelPoints() {
QString scpi = ":CALC%1:TRAN:TIME:LPAS KSDF\n";
scpi = scpi.arg(_trace->channel());
_vna->write(scpi);
}
示例5: prepCall
/**
* Generates a text proposal that the user should announce when calling a match
*
* @param ma the match to call
* @param co the court the match shall be played on
*
* @return a string with the announcement
*/
QString GuiHelpers::prepCall(const QTournament::Match &ma, const QTournament::Court &co, int nCall)
{
int maNum = ma.getMatchNumber();
int coNum = co.getNumber();
QString call = "<i><font color=\"blue\">" + QObject::tr("Please announce:") + "</font></i><br><br><br>";
call += "<big>";
if (nCall == 0)
{
call += QObject::tr("Next match,<br><br>");
} else {
call += "<b><font color=\"darkRed\">%1. ";
call = call.arg(QString::number(nCall + 1));
call += QObject::tr("call");
call += "</font></b>";
call += QObject::tr(" for ");
}
call += QObject::tr("match number ") + "<b><font color=\"darkRed\">%1</font></b>";
call += QObject::tr(" on court number ") + "<b><font color=\"darkRed\">%2</font></b><br><br>";
call = call.arg(maNum);
call = call.arg(coNum);
call += "<center><b>";
call += ma.getCategory().getName() + ",<br><br>";
int winnerRank = ma.getWinnerRank();
if (winnerRank > 0)
{
call += "<font color=\"darkRed\">";
if (winnerRank == 1)
{
call += QObject::tr("FINAL");
} else {
call += QObject::tr("MATCH FOR PLACE %1");
call = call.arg(winnerRank);
}
call += "</font>";
call += ",<br><br>";
}
call += ma.getPlayerPair1().getCallName(QObject::tr("and")) + "<br><br>";
call += QObject::tr("versus<br><br>");
call += ma.getPlayerPair2().getCallName(QObject::tr("and")) + ",<br><br></b></center>";
call += QObject::tr("match number ") + "<b><font color=\"darkRed\">%1</font></b>";
call += QObject::tr(" on court number ") + "<b><font color=\"darkRed\">%2</font></b>";
call = call.arg(maNum);
call = call.arg(coNum);
call += ".";
// add the umpire's name, if necessary
QTournament::REFEREE_MODE refMode = ma.get_EFFECTIVE_RefereeMode();
if ((refMode != QTournament::REFEREE_MODE::NONE) && ((refMode != QTournament::REFEREE_MODE::HANDWRITTEN)))
{
QTournament::upPlayer referee = ma.getAssignedReferee();
if (referee != nullptr)
{
call += "<br><br><br><b>";
call += QObject::tr("Umpire is %1.");
call = call.arg(referee->getDisplayName_FirstNameFirst());
call += "</b><br>";
}
}
// add additional calls, if applicable
if (nCall > 0)
{
call += "<br><br>";
call += "<b><font color=\"darkRed\">";
call += QObject::tr("THIS IS THE %1. CALL!");
call += "</font></b>";
call = call.arg(nCall + 1);
}
call += "</big><br><br><br>";
call += "<i><font color=\"blue\">" + QObject::tr("Call executed?") + "</font></i><br><br><br>";
return call;
}
示例6: if
//.........这里部分代码省略.........
}
else if (genOpt.cardtype == "HDPVR")
{
#ifdef USING_HDPVR
recorder = new MpegRecorder(tvrec);
#endif // USING_HDPVR
}
else if (genOpt.cardtype == "FIREWIRE")
{
#ifdef USING_FIREWIRE
recorder = new FirewireRecorder(
tvrec, dynamic_cast<FirewireChannel*>(channel));
#endif // USING_FIREWIRE
}
else if (genOpt.cardtype == "HDHOMERUN")
{
#ifdef USING_HDHOMERUN
recorder = new HDHRRecorder(
tvrec, dynamic_cast<HDHRChannel*>(channel));
recorder->SetOption("wait_for_seqstart", genOpt.wait_for_seqstart);
#endif // USING_HDHOMERUN
}
else if (genOpt.cardtype == "CETON")
{
#ifdef USING_CETON
recorder = new CetonRecorder(
tvrec, dynamic_cast<CetonChannel*>(channel));
recorder->SetOption("wait_for_seqstart", genOpt.wait_for_seqstart);
#endif // USING_CETON
}
else if (genOpt.cardtype == "DVB")
{
#ifdef USING_DVB
recorder = new DVBRecorder(
tvrec, dynamic_cast<DVBChannel*>(channel));
recorder->SetOption("wait_for_seqstart", genOpt.wait_for_seqstart);
#endif // USING_DVB
}
else if (genOpt.cardtype == "FREEBOX")
{
#ifdef USING_IPTV
recorder = new IPTVRecorder(
tvrec, dynamic_cast<IPTVChannel*>(channel));
recorder->SetOption("mrl", genOpt.videodev);
#endif // USING_IPTV
}
else if (genOpt.cardtype == "ASI")
{
#ifdef USING_ASI
recorder = new ASIRecorder(
tvrec, dynamic_cast<ASIChannel*>(channel));
recorder->SetOption("wait_for_seqstart", genOpt.wait_for_seqstart);
#endif // USING_ASI
}
else if (genOpt.cardtype == "IMPORT")
{
recorder = new ImportRecorder(tvrec);
}
else if (genOpt.cardtype == "DEMO")
{
#ifdef USING_IVTV
recorder = new MpegRecorder(tvrec);
#else
recorder = new ImportRecorder(tvrec);
#endif
}
else if (CardUtil::IsV4L(genOpt.cardtype))
{
#ifdef USING_V4L2
// V4L/MJPEG/GO7007 from here on
recorder = new NuppelVideoRecorder(tvrec, channel);
recorder->SetOption("skipbtaudio", genOpt.skip_btaudio);
#endif // USING_V4L2
}
else if (genOpt.cardtype == "EXTERNAL")
{
recorder = new ExternalRecorder(tvrec,
dynamic_cast<ExternalChannel*>(channel));
}
if (recorder)
{
recorder->SetOptionsFromProfile(
const_cast<RecordingProfile*>(&profile),
genOpt.videodev, genOpt.audiodev, genOpt.vbidev);
// Override the samplerate defined in the profile if this card
// was configured with a fixed rate.
if (genOpt.audiosamplerate)
recorder->SetOption("samplerate", genOpt.audiosamplerate);
}
else
{
QString msg = "Need %1 recorder, but compiled without %2 support!";
msg = msg.arg(genOpt.cardtype).arg(genOpt.cardtype);
LOG(VB_GENERAL, LOG_ERR,
"RecorderBase::CreateRecorder() Error, " + msg);
}
return recorder;
}
示例7: adjustChannelFrequencySpacing
// Harmonic grid:
void VnaTimeDomain::adjustChannelFrequencySpacing() {
QString scpi = ":CALC%1:TRAN:TIME:LPAS KFST\n";
scpi = scpi.arg(_trace->channel());
}
示例8: QStandardItem
SettingsDialog::SettingsDialog(QWidget* parent)
: QDialog(parent),
ui_(new Ui_SettingsDialog),
settingsViewMenu_(new QMenu(this)),
settingsViewGroup_(new QActionGroup(this)),
treeView_(new QAction(this)),
iconView_(new QAction(this)),
generalSettingsModel_(new QStandardItemModel(this)),
tableSettingsModel_(new QStandardItemModel(this)),
plot2dSettingsModel_(new QStandardItemModel(this)),
plot3dSettingsModel_(new QStandardItemModel(this)),
fittingSettingsModel_(new QStandardItemModel(this)),
scriptingSettingsModel_(new QStandardItemModel(this)) {
ui_->setupUi(this);
setWindowTitle(tr("Settings"));
setWindowIcon(IconLoader::load("edit-preference", IconLoader::LightDark));
setModal(true);
setMinimumSize(sizeHint());
// Colors (TODO: use some central qpalette handling)
baseColor_ = palette().color(QPalette::Base);
fontColor_ = palette().color(QPalette::Text);
// adjust layout spacing & margins.
ui_->settingGridLayout->setSpacing(3);
ui_->settingGridLayout->setContentsMargins(0, 0, 0, 0);
ui_->headerHorizontalLayout->setSpacing(0);
ui_->scrollVerticalLayout->setSpacing(0);
ui_->scrollVerticalLayout->setContentsMargins(3, 3, 3, 3);
ui_->scrollVerticalLayout->setContentsMargins(0, 0, 0, 0);
ui_->stackGridLayout->setSpacing(0);
ui_->stackGridLayout->setContentsMargins(0, 0, 0, 0);
// Setup search box.
ui_->searchBox->setMaximumWidth(300);
ui_->searchBox->setToolTip(tr("search"));
// Prepare buttons
ui_->configureButton->setIcon(
IconLoader::load("edit-preference", IconLoader::LightDark));
ui_->settingsButton->setIcon(
IconLoader::load("go-previous", IconLoader::LightDark));
ui_->settingsButton->setEnabled(false);
// Add settings configure menu items(tree/icon view)
settingsViewGroup_->addAction(treeView_);
settingsViewGroup_->addAction(iconView_);
treeView_->setText(tr("Tree view"));
iconView_->setText(tr("Icon view"));
treeView_->setCheckable(true);
iconView_->setCheckable(true);
settingsViewMenu_->addAction(treeView_);
settingsViewMenu_->addAction(iconView_);
ui_->configureButton->setMenu(settingsViewMenu_);
// Prepare scrollarea.
QString scrollbackcol =
"QScrollArea {background-color : "
"rgba(%1,%2,%3,%4); border: 0;}";
ui_->scrollArea->setStyleSheet(scrollbackcol.arg(baseColor_.red())
.arg(baseColor_.green())
.arg(baseColor_.blue())
.arg(baseColor_.alpha()));
// Prepare label.
QString label_font_color =
"QLabel {color : rgba(%1,%2,%3,%4);"
" padding-left: 10px;"
" padding-right: 10px;"
" padding-top: 10px;"
" padding-bottom: 10px}";
ui_->generalLabel->setStyleSheet(label_font_color.arg(fontColor_.red())
.arg(fontColor_.green())
.arg(fontColor_.blue())
.arg(150));
ui_->plot2dLabel->setStyleSheet(label_font_color.arg(fontColor_.red())
.arg(fontColor_.green())
.arg(fontColor_.blue())
.arg(150));
ui_->generalLabel->hide();
ui_->tableLabel->hide();
ui_->plot2dLabel->hide();
ui_->plot3dLabel->hide();
ui_->fittingLabel->hide();
ui_->scriptingLabel->hide();
// Add pages to stack widget
addPage(General, Page_GeneralApplication, new ApplicationSettingsPage(this));
addPage(General, Page_GeneralConfirmation, new ApplicationSettingsPage(this));
addPage(General, Page_GeneralAppearance, new GeneralAppreanceSettings(this));
// Make standard item models for listviews & add items
QStandardItemModel* iStandardModel = new QStandardItemModel(this);
QStandardItem* item1 =
new QStandardItem(QIcon(":/data/document-open-remote.png"), "Open");
QStandardItem* item2 =
new QStandardItem(QIcon(":/data/document-save.png"), "Save");
QStandardItem* item3 =
new QStandardItem(QIcon(":/data/drive-removable-media-usb-pendrive.png"),
"Removable Drive");
//.........这里部分代码省略.........
示例9: out
bool
QFile::copy(const QString &newName)
{
Q_D(QFile);
if (d->fileName.isEmpty()) {
qWarning("QFile::copy: Empty or null file name");
return false;
}
if (QFile(newName).exists()) {
// ### Race condition. If a file is moved in after this, it /will/ be
// overwritten. On Unix, the proper solution is to use hardlinks:
// return ::link(old, new) && ::remove(old); See also rename().
d->setError(QFile::CopyError, tr("Destination file exists"));
return false;
}
unsetError();
close();
if(error() == QFile::NoError) {
if(fileEngine()->copy(newName)) {
unsetError();
return true;
} else {
bool error = false;
if(!open(QFile::ReadOnly)) {
error = true;
d->setError(QFile::CopyError, tr("Cannot open %1 for input").arg(d->fileName));
} else {
QString fileTemplate = QLatin1String("%1/qt_temp.XXXXXX");
#ifdef QT_NO_TEMPORARYFILE
QFile out(fileTemplate.arg(QFileInfo(newName).path()));
if (!out.open(QIODevice::ReadWrite))
error = true;
#else
QTemporaryFile out(fileTemplate.arg(QFileInfo(newName).path()));
if (!out.open()) {
out.setFileTemplate(fileTemplate.arg(QDir::tempPath()));
if (!out.open())
error = true;
}
#endif
if (error) {
out.close();
d->setError(QFile::CopyError, tr("Cannot open for output"));
} else {
char block[4096];
qint64 totalRead = 0;
while(!atEnd()) {
qint64 in = read(block, sizeof(block));
if (in <= 0)
break;
totalRead += in;
if(in != out.write(block, in)) {
d->setError(QFile::CopyError, tr("Failure to write block"));
error = true;
break;
}
}
if (totalRead != size()) {
// Unable to read from the source. The error string is
// already set from read().
error = true;
}
if (!error && !out.rename(newName)) {
error = true;
d->setError(QFile::CopyError, tr("Cannot create %1 for output").arg(newName));
}
#ifdef QT_NO_TEMPORARYFILE
if (error)
out.remove();
#else
if (!error)
out.setAutoRemove(false);
#endif
}
close();
}
if(!error) {
QFile::setPermissions(newName, permissions());
unsetError();
return true;
}
}
}
return false;
}
示例10: if
//.........这里部分代码省略.........
project->variables()["TARGET_EXT"].append(".lib");
}
if ( project->isActiveConfig("windows") ) {
if ( project->isActiveConfig("console") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
} else {
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_WINDOWS_ANY"];
}
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"];
} else {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_CONSOLE_ANY"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_CONSOLE"];
}
project->variables()["MSVCDSP_VER"] = "6.00";
project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI";
if(!project->isActiveConfig("incremental")) {
project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no"));
if ( is_qt )
project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /Zi";
}
QString msvcdsp_project;
if ( project->variables()["TARGET"].count() )
msvcdsp_project = project->variables()["TARGET"].first();
QString targetfilename = project->variables()["TARGET"].first();
project->variables()["TARGET"].first() += project->first("TARGET_EXT");
if ( project->isActiveConfig("moc") )
setMocAware(TRUE);
project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
"HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
QStringList &l = project->variables()["QMAKE_FILETAGS"];
for(it = l.begin(); it != l.end(); ++it) {
QStringList &gdmf = project->variables()[(*it)];
for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
(*inner) = Option::fixPathToTargetOS((*inner), FALSE);
}
MakefileGenerator::init();
if ( msvcdsp_project.isEmpty() )
msvcdsp_project = Option::output.name();
msvcdsp_project = msvcdsp_project.right( msvcdsp_project.length() - msvcdsp_project.findRev( "\\" ) - 1 );
msvcdsp_project = msvcdsp_project.left( msvcdsp_project.findRev( "." ) );
msvcdsp_project.replace("-", "");
project->variables()["MSVCDSP_PROJECT"].append(msvcdsp_project);
QStringList &proj = project->variables()["MSVCDSP_PROJECT"];
for(it = proj.begin(); it != proj.end(); ++it)
(*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), "");
if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
project->variables()["MSVCDSP_TEMPLATE"].append("win32app" + project->first( "DSP_EXTENSION" ) );
if ( project->isActiveConfig("console") ) {
project->variables()["MSVCDSP_CONSOLE"].append("Console");
示例11: file
bool
DspMakefileGenerator::writeDspParts(QTextStream &t)
{
QString dspfile;
if ( !project->variables()["DSP_TEMPLATE"].isEmpty() ) {
dspfile = project->first("DSP_TEMPLATE");
} else {
dspfile = project->first("MSVCDSP_TEMPLATE");
}
if (dspfile.startsWith("\"") && dspfile.endsWith("\""))
dspfile = dspfile.mid(1, dspfile.length() - 2);
QString dspfile_loc = findTemplate(dspfile);
QFile file(dspfile_loc);
if(!file.open(IO_ReadOnly)) {
fprintf(stderr, "Cannot open dsp file: %s\n", dspfile.latin1());
return FALSE;
}
QTextStream dsp(&file);
QString platform = "Win32";
if ( !project->variables()["QMAKE_PLATFORM"].isEmpty() )
platform = varGlue("QMAKE_PLATFORM", "", " ", "");
// Setup PCH variables
precompH = project->first("PRECOMPILED_HEADER");
QString namePCH = QFileInfo(precompH).fileName();
usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header");
if (usePCH) {
// Created files
QString origTarget = project->first("QMAKE_ORIG_TARGET");
origTarget.replace(QRegExp("-"), "_");
precompObj = "\"$(IntDir)\\" + origTarget + Option::obj_ext + "\"";
precompPch = "\"$(IntDir)\\" + origTarget + ".pch\"";
// Add PRECOMPILED_HEADER to HEADERS
if (!project->variables()["HEADERS"].contains(precompH))
project->variables()["HEADERS"] += precompH;
// Add precompile compiler options
project->variables()["PRECOMPILED_FLAGS_REL"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" ";
project->variables()["PRECOMPILED_FLAGS_DEB"] = "/Yu\"" + namePCH + "\" /FI\"" + namePCH + "\" ";
// Return to variable pool
project->variables()["PRECOMPILED_OBJECT"] = precompObj;
project->variables()["PRECOMPILED_PCH"] = precompPch;
}
int rep;
QString line;
while ( !dsp.eof() ) {
line = dsp.readLine();
while((rep = line.find(QRegExp("\\$\\$[a-zA-Z0-9_-]*"))) != -1) {
QString torep = line.mid(rep, line.find(QRegExp("[^\\$a-zA-Z0-9_-]"), rep) - rep);
QString variable = torep.right(torep.length()-2);
t << line.left(rep); //output the left side
line = line.right(line.length() - (rep + torep.length())); //now past the variable
if(variable == "MSVCDSP_SOURCES") {
if(project->variables()["SOURCES"].isEmpty())
continue;
QString mocpath = var( "QMAKE_MOC" );
mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " ";
QStringList list = project->variables()["SOURCES"] + project->variables()["DEF_FILE"];
if(!project->isActiveConfig("flat"))
list.sort();
QStringList::Iterator it;
for( it = list.begin(); it != list.end(); ++it) {
beginGroupForFile((*it), t);
t << "# Begin Source File\n\nSOURCE=" << (*it) << endl;
if (usePCH && (*it).endsWith(".c"))
t << "# SUBTRACT CPP /FI\"" << namePCH << "\" /Yu\"" << namePCH << "\" /Fp" << endl;
if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) {
QString base = (*it);
base.replace(QRegExp("\\..*$"), "").upper();
base.replace(QRegExp("[^a-zA-Z]"), "_");
QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) +
"...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\""
" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n"
"\t" + mocpath + findMocSource((*it)) + " -o " +
(*it) + "\n\n" "# End Custom Build\n\n";
t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl;
t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build
<< "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\""
<< build << "!ENDIF " << endl << endl;
}
t << "# End Source File" << endl;
}
endGroups(t);
} else if(variable == "MSVCDSP_IMAGES") {
if(project->variables()["IMAGES"].isEmpty())
continue;
t << "# Begin Source File\n\nSOURCE=" << project->first("QMAKE_IMAGE_COLLECTION") << endl;
t << "# End Source File" << endl;
} else if(variable == "MSVCDSP_HEADERS") {
if(project->variables()["HEADERS"].isEmpty())
continue;
QStringList list = project->variables()["HEADERS"];
//.........这里部分代码省略.........
示例12: Ident
QString Room_Reservation_Base::Ident() const
{
QString out = "<Room_Reservation @%1 room#=%2 created=%3>";
out = out.arg( dbid ).arg( roomNumber );
return out.arg( dateCreated.toString("yyyy-MM-dd") );
}
示例13: updateFields
void UIItemHostNetwork::updateFields()
{
/* Compose item fields: */
setText(Column_Name, m_interface.m_strName);
setText(Column_IPv4, m_interface.m_strAddress.isEmpty() ? QString() :
QString("%1/%2").arg(m_interface.m_strAddress).arg(maskToCidr(m_interface.m_strMask)));
setText(Column_IPv6, m_interface.m_strAddress6.isEmpty() || !m_interface.m_fSupportedIPv6 ? QString() :
QString("%1/%2").arg(m_interface.m_strAddress6).arg(m_interface.m_strPrefixLength6.toInt()));
setText(Column_DHCP, tr("Enable", "DHCP Server"));
setCheckState(Column_DHCP, m_dhcpserver.m_fEnabled ? Qt::Checked : Qt::Unchecked);
/* Compose item tool-tip: */
const QString strTable("<table cellspacing=5>%1</table>");
const QString strHeader("<tr><td><nobr>%1: </nobr></td><td><nobr>%2</nobr></td></tr>");
const QString strSubHeader("<tr><td><nobr> %1: </nobr></td><td><nobr>%2</nobr></td></tr>");
QString strToolTip;
/* Interface information: */
strToolTip += strHeader.arg(tr("Adapter"))
.arg(m_interface.m_fDHCPEnabled ?
tr("Automatically configured", "interface") :
tr("Manually configured", "interface"));
strToolTip += strSubHeader.arg(tr("IPv4 Address"))
.arg(m_interface.m_strAddress.isEmpty() ?
tr ("Not set", "address") :
m_interface.m_strAddress) +
strSubHeader.arg(tr("IPv4 Network Mask"))
.arg(m_interface.m_strMask.isEmpty() ?
tr ("Not set", "mask") :
m_interface.m_strMask);
if (m_interface.m_fSupportedIPv6)
{
strToolTip += strSubHeader.arg(tr("IPv6 Address"))
.arg(m_interface.m_strAddress6.isEmpty() ?
tr("Not set", "address") :
m_interface.m_strAddress6) +
strSubHeader.arg(tr("IPv6 Prefix Length"))
.arg(m_interface.m_strPrefixLength6.isEmpty() ?
tr("Not set", "length") :
m_interface.m_strPrefixLength6);
}
/* DHCP server information: */
strToolTip += strHeader.arg(tr("DHCP Server"))
.arg(m_dhcpserver.m_fEnabled ?
tr("Enabled", "server") :
tr("Disabled", "server"));
if (m_dhcpserver.m_fEnabled)
{
strToolTip += strSubHeader.arg(tr("Address"))
.arg(m_dhcpserver.m_strAddress.isEmpty() ?
tr("Not set", "address") :
m_dhcpserver.m_strAddress) +
strSubHeader.arg(tr("Network Mask"))
.arg(m_dhcpserver.m_strMask.isEmpty() ?
tr("Not set", "mask") :
m_dhcpserver.m_strMask) +
strSubHeader.arg(tr("Lower Bound"))
.arg(m_dhcpserver.m_strLowerAddress.isEmpty() ?
tr("Not set", "bound") :
m_dhcpserver.m_strLowerAddress) +
strSubHeader.arg(tr("Upper Bound"))
.arg(m_dhcpserver.m_strUpperAddress.isEmpty() ?
tr("Not set", "bound") :
m_dhcpserver.m_strUpperAddress);
}
/* Assign tool-tip finally: */
setToolTip(Column_Name, strTable.arg(strToolTip));
}
示例14: displayLanguageTop
void TopSceneParameter::displayLanguageTop(const QString &_value)
{
QString sql = "SELECT a.* FROM Song AS a where a.songLanguage='%1' ORDER BY a.songPlayCount DESC";
displayTop(sql.arg(_value));
}
示例15: tr
void
AddIntervalDialog::createClicked()
{
const RideFile *ride = context->currentRide();
if (!ride) {
QMessageBox::critical(this, tr("Select Ride"), tr("No ride selected!"));
return;
}
int maxIntervals = (int) countSpinBox->value();
double windowSizeSecs = (hrsSpinBox->value() * 3600.0
+ minsSpinBox->value() * 60.0
+ secsSpinBox->value());
double windowSizeMeters = (kmsSpinBox->value() * 1000.0
+ msSpinBox->value());
if (windowSizeSecs == 0.0) {
QMessageBox::critical(this, tr("Bad Interval Length"),
tr("Interval length must be greater than zero!"));
return;
}
bool byTime = typeTime->isChecked();
QList<AddedInterval> results;
if (methodBestPower->isChecked()) {
if (peakPowerStandard->isChecked())
findPeakPowerStandard(ride, results);
else
findBests(byTime, ride, (byTime?windowSizeSecs:windowSizeMeters), maxIntervals, results, "");
}
else
findFirsts(byTime, ride, (byTime?windowSizeSecs:windowSizeMeters), maxIntervals, results);
// clear the table
clearResultsTable(resultsTable);
// populate the table
resultsTable->setRowCount(results.size());
int row = 0;
foreach (const AddedInterval &interval, results) {
double secs = interval.start;
double mins = floor(secs / 60);
secs = secs - mins * 60.0;
double hrs = floor(mins / 60);
mins = mins - hrs * 60.0;
// check box
QCheckBox *c = new QCheckBox;
c->setCheckState(Qt::Checked);
resultsTable->setCellWidget(row, 0, c);
// start time
QString start = "%1:%2:%3";
start = start.arg(hrs, 0, 'f', 0);
start = start.arg(mins, 2, 'f', 0, QLatin1Char('0'));
start = start.arg(round(secs), 2, 'f', 0, QLatin1Char('0'));
QTableWidgetItem *t = new QTableWidgetItem;
t->setText(start);
t->setFlags(t->flags() & (~Qt::ItemIsEditable));
resultsTable->setItem(row, 1, t);
QTableWidgetItem *n = new QTableWidgetItem;
n->setText(interval.name);
n->setFlags(n->flags() | (Qt::ItemIsEditable));
resultsTable->setItem(row, 2, n);
// hidden columns - start, stop
QString strt = QString("%1").arg(interval.start); // can't use secs as it gets modified
QTableWidgetItem *st = new QTableWidgetItem;
st->setText(strt);
resultsTable->setItem(row, 3, st);
QString stp = QString("%1").arg(interval.stop); // was interval.start+x
QTableWidgetItem *sp = new QTableWidgetItem;
sp->setText(stp);
resultsTable->setItem(row, 4, sp);
row++;
}