本文整理汇总了C++中QLocale函数的典型用法代码示例。如果您正苦于以下问题:C++ QLocale函数的具体用法?C++ QLocale怎么用?C++ QLocale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QLocale函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: domPropertyToVariant
//.........这里部分代码省略.........
case DomProperty::Font: {
const DomFont *font = p->elementFont();
QFont f;
if (font->hasElementFamily() && !font->elementFamily().isEmpty())
f.setFamily(font->elementFamily());
if (font->hasElementPointSize() && font->elementPointSize() > 0)
f.setPointSize(font->elementPointSize());
if (font->hasElementWeight() && font->elementWeight() > 0)
f.setWeight(font->elementWeight());
if (font->hasElementItalic())
f.setItalic(font->elementItalic());
if (font->hasElementBold())
f.setBold(font->elementBold());
if (font->hasElementUnderline())
f.setUnderline(font->elementUnderline());
if (font->hasElementStrikeOut())
f.setStrikeOut(font->elementStrikeOut());
if (font->hasElementKerning())
f.setKerning(font->elementKerning());
if (font->hasElementAntialiasing())
f.setStyleStrategy(font->elementAntialiasing() ? QFont::PreferDefault : QFont::NoAntialias);
if (font->hasElementStyleStrategy()) {
f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
}
return QVariant::fromValue(f);
}
case DomProperty::Date: {
const DomDate *date = p->elementDate();
return QVariant(QDate(date->elementYear(), date->elementMonth(), date->elementDay()));
}
case DomProperty::Time: {
const DomTime *t = p->elementTime();
return QVariant(QTime(t->elementHour(), t->elementMinute(), t->elementSecond()));
}
case DomProperty::DateTime: {
const DomDateTime *dateTime = p->elementDateTime();
const QDate d(dateTime->elementYear(), dateTime->elementMonth(), dateTime->elementDay());
const QTime tm(dateTime->elementHour(), dateTime->elementMinute(), dateTime->elementSecond());
return QVariant(QDateTime(d, tm));
}
case DomProperty::Url: {
const DomUrl *url = p->elementUrl();
return QVariant(QUrl(url->elementString()->text()));
}
#ifndef QT_NO_CURSOR
case DomProperty::Cursor:
return QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));
case DomProperty::CursorShape:
return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
#endif
case DomProperty::Locale: {
const DomLocale *locale = p->elementLocale();
return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
}
case DomProperty::SizePolicy: {
const DomSizePolicy *sizep = p->elementSizePolicy();
QSizePolicy sizePolicy;
sizePolicy.setHorizontalStretch(sizep->elementHorStretch());
sizePolicy.setVerticalStretch(sizep->elementVerStretch());
const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");
if (sizep->hasElementHSizeType()) {
sizePolicy.setHorizontalPolicy((QSizePolicy::Policy) sizep->elementHSizeType());
} else if (sizep->hasAttributeHSizeType()) {
const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeHSizeType().toLatin1());
sizePolicy.setHorizontalPolicy(sp);
}
if (sizep->hasElementVSizeType()) {
sizePolicy.setVerticalPolicy((QSizePolicy::Policy) sizep->elementVSizeType());
} else if (sizep->hasAttributeVSizeType()) {
const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeVSizeType().toLatin1());
sizePolicy.setVerticalPolicy(sp);
}
return QVariant::fromValue(sizePolicy);
}
case DomProperty::StringList:
return QVariant(p->elementStringList()->elementString());
default:
uiLibWarning(QCoreApplication::translate("QFormBuilder", "Reading properties of the type %1 is not supported yet.").arg(p->kind()));
break;
}
return QVariant();
}
开发者ID:hkahn,项目名称:qt5-qttools-nacl,代码行数:101,代码来源:properties.cpp
示例2: serverPath
MapAdapter::MapAdapter(const QString& host, const QString& serverPath, int tilesize, int minZoom, int maxZoom)
:myhost(host), serverPath(serverPath), mytilesize(tilesize), min_zoom(minZoom), max_zoom(maxZoom)
{
current_zoom = min_zoom;
loc = QLocale(QLocale::English);
}
开发者ID:BlitzGLEP1326,项目名称:opencitymap,代码行数:6,代码来源:mapadapter.cpp
示例3: refresh_qimage
int refresh_qimage( producer_qimage self, mlt_frame frame )
{
// Obtain properties of frame and producer
mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
mlt_producer producer = &self->parent;
mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
// Check if user wants us to reload the image
if ( mlt_properties_get_int( producer_props, "force_reload" ) )
{
self->qimage = NULL;
self->current_image = NULL;
mlt_properties_set_int( producer_props, "force_reload", 0 );
}
// Get the time to live for each frame
double ttl = mlt_properties_get_int( producer_props, "ttl" );
// Get the original position of this frame
mlt_position position = mlt_frame_original_position( frame );
position += mlt_producer_get_in( producer );
// Image index
int image_idx = ( int )floor( ( double )position / ttl ) % self->count;
// Key for the cache
char image_key[ 10 ];
sprintf( image_key, "%d", image_idx );
int disable_exif = mlt_properties_get_int( producer_props, "disable_exif" );
if ( app == NULL )
{
if ( qApp )
{
app = qApp;
}
else
{
#ifdef linux
if ( getenv("DISPLAY") == 0 )
{
mlt_log_panic( MLT_PRODUCER_SERVICE( producer ), "Error, cannot render titles without an X11 environment.\nPlease either run melt from an X session or use a fake X server like xvfb:\nxvfb-run -a melt (...)\n" );
return -1;
}
#endif
int argc = 1;
char* argv[1];
argv[0] = (char*) "xxx";
app = new QApplication( argc, argv );
const char *localename = mlt_properties_get_lcnumeric( MLT_SERVICE_PROPERTIES( MLT_PRODUCER_SERVICE( producer ) ) );
QLocale::setDefault( QLocale( localename ) );
}
}
if ( image_idx != self->qimage_idx )
self->qimage = NULL;
if ( !self->qimage || mlt_properties_get_int( producer_props, "_disable_exif" ) != disable_exif )
{
self->current_image = NULL;
QImage *qimage = new QImage( QString::fromUtf8( mlt_properties_get_value( self->filenames, image_idx ) ) );
self->qimage = qimage;
if ( !qimage->isNull( ) )
{
// Read the exif value for this file
if ( !disable_exif )
qimage = reorient_with_exif( self, image_idx, qimage );
// Register qimage for destruction and reuse
mlt_cache_item_close( self->qimage_cache );
mlt_service_cache_put( MLT_PRODUCER_SERVICE( producer ), "qimage.qimage", qimage, 0, ( mlt_destructor )qimage_delete );
self->qimage_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "qimage.qimage" );
self->qimage_idx = image_idx;
// Store the width/height of the qimage
self->current_width = qimage->width( );
self->current_height = qimage->height( );
mlt_events_block( producer_props, NULL );
mlt_properties_set_int( producer_props, "meta.media.width", self->current_width );
mlt_properties_set_int( producer_props, "meta.media.height", self->current_height );
mlt_properties_set_int( producer_props, "_disable_exif", disable_exif );
mlt_events_unblock( producer_props, NULL );
}
else
{
delete qimage;
self->qimage = NULL;
}
}
// Set width/height of frame
mlt_properties_set_int( properties, "width", self->current_width );
mlt_properties_set_int( properties, "height", self->current_height );
return image_idx;
}
开发者ID:adiibanez,项目名称:mlt,代码行数:99,代码来源:qimage_wrapper.cpp
示例4: AddLocale
void AcceptLangWidget::on_Add__released ()
{
const auto country = GetValue<QLocale::Country> (Ui_.Country_);
const auto lang = GetValue<QLocale::Language> (Ui_.Language_);
AddLocale (QLocale (lang, country));
}
开发者ID:AlexWMF,项目名称:leechcraft,代码行数:6,代码来源:acceptlangwidget.cpp
示例5: defined
//.........这里部分代码省略.........
// first start up of this program.
//
bool fontMatchFound = false;
for (int i = 0; i < preferredFonts.size(); i++)
{
fontMatchFound =
std::binary_search
(
fontFamilies.begin(),
fontFamilies.end(),
preferredFonts[i]
);
if (fontMatchFound)
{
defaultFont = QFont(preferredFonts[i]);
break;
}
}
if (!fontMatchFound)
{
// This case should not really happen, since the Courier family is
// cross-platform. This is just a precaution.
//
qWarning() <<
"No fixed-width fonts were found. Using sytem default...";
defaultFont = QFont("");
defaultFont.setFixedPitch(true);
defaultFont.setStyleHint(QFont::Monospace);
}
// Last but not least, load some basic settings from the configuration file,
// but only those that need special validation. Things like window
// dimensions and file history can be handled elsewhere.
//
QSettings appSettings;
autoSaveEnabled = appSettings.value(GW_AUTOSAVE_KEY, QVariant(true)).toBool();
backupFileEnabled = appSettings.value(GW_BACKUP_FILE_KEY, QVariant(true)).toBool();
font = defaultFont;
font.fromString(appSettings.value(GW_FONT_KEY, QVariant(defaultFont.toString())).toString());
tabWidth = appSettings.value(GW_TAB_WIDTH_KEY, QVariant(DEFAULT_TAB_WIDTH)).toInt();
if ((tabWidth < MIN_TAB_WIDTH) || (tabWidth > MAX_TAB_WIDTH))
{
tabWidth = DEFAULT_TAB_WIDTH;
}
insertSpacesForTabsEnabled = appSettings.value(GW_SPACES_FOR_TABS_KEY, QVariant(false)).toBool();
useUnderlineForEmphasis = appSettings.value(GW_UNDERLINE_ITALICS_KEY, QVariant(false)).toBool();
largeHeadingSizesEnabled = appSettings.value(GW_LARGE_HEADINGS_KEY, QVariant(true)).toBool();
autoMatchEnabled = appSettings.value(GW_AUTO_MATCH_KEY, QVariant(true)).toBool();
autoMatchDoubleQuotesEnabled = appSettings.value(GW_AUTO_MATCH_DOUBLE_QUOTES_KEY, QVariant(true)).toBool();
autoMatchSingleQuotesEnabled = appSettings.value(GW_AUTO_MATCH_SINGLE_QUOTES_KEY, QVariant(true)).toBool();
autoMatchParenthesesEnabled = appSettings.value(GW_AUTO_MATCH_PARENTHESES_KEY, QVariant(true)).toBool();
autoMatchSquareBracketsEnabled = appSettings.value(GW_AUTO_MATCH_SQUARE_BRACKETS_KEY, QVariant(true)).toBool();
autoMatchBracesEnabled = appSettings.value(GW_AUTO_MATCH_BRACES_KEY, QVariant(true)).toBool();
autoMatchAsterisksEnabled = appSettings.value(GW_AUTO_MATCH_ASTERISKS_KEY, QVariant(true)).toBool();
autoMatchUnderscoresEnabled = appSettings.value(GW_AUTO_MATCH_UNDERSCORES_KEY, QVariant(true)).toBool();
autoMatchBackticksEnabled = appSettings.value(GW_AUTO_MATCH_BACKTICKS_KEY, QVariant(true)).toBool();
autoMatchAngleBracketsEnabled = appSettings.value(GW_AUTO_MATCH_ANGLE_BRACKETS_KEY, QVariant(true)).toBool();
bulletPointCyclingEnabled = appSettings.value(GW_BULLET_CYCLING_KEY, QVariant(true)).toBool();
focusMode = (FocusMode) appSettings.value(GW_FOCUS_MODE_KEY, QVariant(FocusModeSentence)).toInt();
if ((focusMode < FocusModeDisabled) || (focusMode > FocusModeParagraph))
{
focusMode = FocusModeSentence;
}
hideMenuBarInFullScreenEnabled = appSettings.value(GW_HIDE_MENU_BAR_IN_FULL_SCREEN_KEY, QVariant(true)).toBool();
fileHistoryEnabled = appSettings.value(GW_REMEMBER_FILE_HISTORY_KEY, QVariant(true)).toBool();
displayTimeInFullScreenEnabled = appSettings.value(GW_DISPLAY_TIME_IN_FULL_SCREEN_KEY, QVariant(true)).toBool();
themeName = appSettings.value(GW_THEME_KEY, QVariant("Classic Light")).toString();
dictionaryLanguage = appSettings.value(GW_DICTIONARY_KEY, QLocale().name()).toString();
locale = appSettings.value(GW_LOCALE_KEY, QLocale().name()).toString();
liveSpellCheckEnabled = appSettings.value(GW_LIVE_SPELL_CHECK_KEY, QVariant(true)).toBool();
editorWidth = (EditorWidth) appSettings.value(GW_EDITOR_WIDTH_KEY, QVariant(EditorWidthMedium)).toInt();
blockquoteStyle = (BlockquoteStyle) appSettings.value(GW_BLOCKQUOTE_STYLE_KEY, QVariant(BlockquoteStylePlain)).toInt();
if ((editorWidth < EditorWidthNarrow) || (editorWidth > EditorWidthFull))
{
editorWidth = EditorWidthMedium;
}
#ifdef Q_OS_MAC
HudWindowButtonLayout defaultHudButtonLayout = HudWindowButtonLayoutLeft;
#else
HudWindowButtonLayout defaultHudButtonLayout = HudWindowButtonLayoutRight;
#endif
hudButtonLayout = (HudWindowButtonLayout) appSettings.value(GW_HUD_BUTTON_LAYOUT_KEY, QVariant(defaultHudButtonLayout)).toInt();
alternateHudRowColorsEnabled = appSettings.value(GW_HUD_ROW_COLORS_KEY, QVariant(false)).toBool();
desktopCompositingEnabled = appSettings.value(GW_DESKTOP_COMPOSITING_KEY, QVariant(true)).toBool();
hudOpacity = appSettings.value(GW_HUD_OPACITY_KEY, QVariant(200)).toInt();
}
开发者ID:wereturtle,项目名称:ghostwriter,代码行数:101,代码来源:AppSettings.cpp
示例6: getLocale
std::string getLocale()
{
return QLocale().name().toStdString();
}
开发者ID:callcc,项目名称:gideros,代码行数:4,代码来源:platform-qt.cpp
示例7: QMainWindow
//.........这里部分代码省略.........
pen.setCapStyle(Qt::RoundCap);
// The line is used to draw classic graphs
QPen line;
line.setColor(QColor(25,118,210,255));
line.setWidth(1);
QPen line_red;
line_red.setColor(QColor(210,25,118,255));
line_red.setWidth(1);
QPen line_green;
line_green.setColor(QColor(118,210,25,255));
line_green.setWidth(1);
// Graph 1 to 6 stores the accelerometer and gyroscope
// axis, and share similar settings.
// Their label can be set directly in the next array
QString label[16] = {
"",
"X","Y","Z", // Accelerometer's three axis
"X","Y","Z" // Gyroscope's three axis
};
for(int i=1;i<8;i++) {
// Only one curve on those graphs : axis/time
graph[i]->addGraph();
// The datas are stored in x[1] (time) and y[i] vectors
graph[i]->graph(0)->setData(*x[1],*y[i]);
graph[i]->graph(0)->setPen(line);
// Setting the labels of each axis, as well
// as the range
graph[i]->xAxis->setLabel("t");
graph[i]->yAxis->setLabel(label[i]);
graph[i]->yAxis->setRange(-32000,32000);
// The X Axis should display time (text)
graph[i]->setLocale(QLocale(QLocale::English, QLocale::Canada));
graph[i]->xAxis->setTickLabelType(QCPAxis::ltDateTime);
graph[i]->xAxis->setDateTimeFormat("hh:mm:ss");
graph[i]->xAxis->setDateTimeSpec(Qt::OffsetFromUTC);
// Activating the zoom and drag interraction in vertical mode
graph[i]->setInteraction(QCP::iRangeDrag, true);
graph[i]->setInteraction(QCP::iRangeZoom, true);
graph[i]->yAxis->axisRect()->setRangeDrag(Qt::Vertical);
graph[i]->yAxis->axisRect()->setRangeZoom(Qt::Vertical);
}
graph[2]->graph(0)->setPen(line_green);
graph[3]->graph(0)->setPen(line_red);
graph[5]->graph(0)->setPen(line_green);
graph[6]->graph(0)->setPen(line_red);
graph[7]->yAxis->setRange(0,150);
// Populating the XY graph
// Only one curve on this graph : X axis /Y axis of accelerometer
graph[0]->addGraph();
// The datas are stored in x[0] and y[0] vectors
graph[0]->graph(0)->setData(*x[0],*y[0]);
// Draw a red dot
graph[0]->graph(0)->setPen(pen);
// Setting the labels of each axis, as well
// as the range
graph[0]->xAxis->setLabel("X");
graph[0]->yAxis->setLabel("Y");
graph[0]->xAxis->setRange(-10000,10000);
graph[0]->yAxis->setRange(-10000,10000);
// Activating the zoom and drag interraction in vertical and horizontal mode
graph[0]->setInteraction(QCP::iRangeDrag, true);
graph[0]->setInteraction(QCP::iRangeZoom, true);
开发者ID:Sceap,项目名称:BarkingSquirrel,代码行数:67,代码来源:mainwindow.cpp
示例8: QDialog
//.........这里部分代码省略.........
m_background_image->setImage(m_theme.backgroundImage(), m_theme.backgroundPath());
connect(m_background_image, SIGNAL(changed(QString)), this, SLOT(imageChanged()));
m_clear_image = new QPushButton(tr("Remove"), background_group);
connect(m_clear_image, SIGNAL(clicked()), m_background_image, SLOT(unsetImage()));
m_background_type = new QComboBox(background_group);
m_background_type->addItems(QStringList() << tr("No Image") << tr("Tiled") << tr("Centered") << tr("Stretched") << tr("Scaled") << tr("Zoomed"));
m_background_type->setCurrentIndex(m_theme.backgroundType());
connect(m_background_type, SIGNAL(activated(int)), this, SLOT(renderPreview()));
QVBoxLayout* image_layout = new QVBoxLayout;
image_layout->setSpacing(0);
image_layout->setMargin(0);
image_layout->addWidget(m_background_image);
image_layout->addWidget(m_clear_image);
QFormLayout* background_layout = new QFormLayout(background_group);
background_layout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
background_layout->addRow(tr("Color:"), m_background_color);
background_layout->addRow(tr("Image:"), image_layout);
background_layout->addRow(tr("Type:"), m_background_type);
// Create foreground group
QGroupBox* foreground_group = new QGroupBox(tr("Text Background"), contents);
m_foreground_color = new ColorButton(foreground_group);
m_foreground_color->setColor(m_theme.foregroundColor());
connect(m_foreground_color, SIGNAL(changed(QColor)), this, SLOT(renderPreview()));
m_foreground_opacity = new QSpinBox(foreground_group);
m_foreground_opacity->setCorrectionMode(QSpinBox::CorrectToNearestValue);
m_foreground_opacity->setSuffix(QLocale().percent());
m_foreground_opacity->setRange(theme.foregroundOpacity().minimumValue(), theme.foregroundOpacity().maximumValue());
m_foreground_opacity->setValue(m_theme.foregroundOpacity());
connect(m_foreground_opacity, SIGNAL(valueChanged(int)), this, SLOT(renderPreview()));
m_foreground_position = new QComboBox(foreground_group);
m_foreground_position->addItems(QStringList() << tr("Left") << tr("Centered") << tr("Right") << tr("Stretched"));
m_foreground_position->setCurrentIndex(m_theme.foregroundPosition());
connect(m_foreground_position, SIGNAL(currentIndexChanged(int)), this, SLOT(positionChanged(int)));
m_foreground_width = new QSpinBox(foreground_group);
m_foreground_width->setCorrectionMode(QSpinBox::CorrectToNearestValue);
m_foreground_width->setSuffix(tr(" pixels"));
m_foreground_width->setRange(theme.foregroundWidth().minimumValue(), theme.foregroundWidth().maximumValue());
m_foreground_width->setValue(m_theme.foregroundWidth());
m_foreground_width->setEnabled(m_theme.foregroundPosition() != 3);
connect(m_foreground_width, SIGNAL(valueChanged(int)), this, SLOT(renderPreview()));
QFormLayout* foreground_layout = new QFormLayout(foreground_group);
foreground_layout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
foreground_layout->addRow(tr("Color:"), m_foreground_color);
foreground_layout->addRow(tr("Opacity:"), m_foreground_opacity);
foreground_layout->addRow(tr("Position:"), m_foreground_position);
foreground_layout->addRow(tr("Width:"), m_foreground_width);
// Create rounding group
m_round_corners = new QGroupBox(tr("Round Text Background Corners"), contents);
m_round_corners->setCheckable(true);
m_round_corners->setChecked(m_theme.roundCornersEnabled());
connect(m_round_corners, SIGNAL(clicked()), this, SLOT(renderPreview()));
m_corner_radius = new QSpinBox(m_round_corners);
开发者ID:aaa162,项目名称:focuswriter,代码行数:67,代码来源:theme_dialog.cpp
示例9: main
int main(int argc, char *argv[])
{
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
julyTranslator=new JulyTranslator;
appDataDir_=new QByteArray();
appVerIsBeta_=new bool(false);
appVerStr_=new QByteArray("1.0707");
appVerReal_=new double(appVerStr.toDouble());
if(appVerStr.size()>4)
{
appVerStr.insert(4,".");
if(appVerStr.at(appVerStr.size()-1)!='0')appVerIsBeta=true;
}
appVerLastReal_=new double(appVerReal);
currencyBStr_=new QByteArray("USD");
currencyBStrLow_=new QByteArray("usd");
currencyBSign_=new QByteArray("USD");
validKeySign_=new bool(false);
currencyASign_=new QByteArray("BTC");
currencyAStr_=new QByteArray("BTC");
currencyAStrLow_=new QByteArray("btc");
currencyRequest_=new QByteArray("BTCUSD");
defaultLangFile_=new QString();pickDefaultLangFile();
currencySignMap=new QMap<QByteArray,QByteArray>;
currencyNamesMap=new QMap<QByteArray,QByteArray>;
dateTimeFormat_=new QString(QLocale().dateTimeFormat(QLocale::ShortFormat));
timeFormat_=new QString(QLocale().timeFormat(QLocale::ShortFormat));
exchangeName_=new QString("Mt.Gox");
btcDecimals_=new int(8);
usdDecimals_=new int(5);
priceDecimals_=new int(5);
minTradePrice_=new double(0.01);
minTradeVolume_=new double(0.01);
currentTimeStamp_=new qint32(QDateTime::currentDateTime().toTime_t());
httpRequestInterval_=new int(400);
httpRequestTimeout_=new int(5);
QString globalStyleSheet="QGroupBox {background: rgba(255,255,255,190); border: 1px solid gray;border-radius: 3px;margin-top: 7px;} QGroupBox:title {background: qradialgradient(cx: 0.5, cy: 0.5, fx: 0.5, fy: 0.5, radius: 0.7, stop: 0 #fff, stop: 1 transparent); border-radius: 2px; padding: 1 4px; top: -7; left: 7px;} QLabel {color: black;} QDoubleSpinBox {background: white;} QTextEdit {background: white;} QPlainTextEdit {background: white;} QCheckBox {color: black;} QLineEdit {color: black; background: white; border: 1px solid gray;}";
#ifdef Q_OS_WIN
if(QFile::exists("./QtBitcoinTrader"))
{
appDataDir="./QtBitcoinTrader/";
QDir().mkpath(appDataDir+"Language");
if(!QFile::exists(appDataDir+"Language"))appDataDir.clear();
}
if(appDataDir.isEmpty())
{
appDataDir=QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace("\\","/").toAscii()+"/QtBitcoinTrader/";
if(!QFile::exists(appDataDir))QDir().mkpath(appDataDir);
}
#else
appDataDir=QDesktopServices::storageLocation(QDesktopServices::HomeLocation).toAscii()+"/.config/QtBitcoinTrader/";
if(!QFile::exists(appDataDir))QDir().mkpath(appDataDir);
#endif
if(argc>1)
{
QApplication a(argc,argv);
if(a.arguments().last().startsWith("/checkupdate"))
{
#ifndef Q_OS_WIN
a.setStyle(new QPlastiqueStyle);
#endif
a.setStyleSheet(globalStyleSheet);
QSettings settings(appDataDir+"/Settings.set",QSettings::IniFormat);
QString langFile=settings.value("LanguageFile","").toString();
if(langFile.isEmpty()||!langFile.isEmpty()&&!QFile::exists(langFile))langFile=defaultLangFile;
julyTranslator->loadFromFile(langFile);
UpdaterDialog updater(a.arguments().last()!="/checkupdate");
return a.exec();
}
}
QApplication a(argc,argv);
#ifndef Q_OS_WIN
a.setStyle(new QPlastiqueStyle);
#endif
#ifdef Q_OS_WIN
if(QFile::exists(a.applicationFilePath()+".upd"))QFile::remove(a.applicationFilePath()+".upd");
if(QFile::exists(a.applicationFilePath()+".bkp"))QFile::remove(a.applicationFilePath()+".bkp");
#endif
#ifdef Q_OS_MAC
if(QFile::exists(a.applicationFilePath()+".upd"))QFile::remove(a.applicationFilePath()+".upd");
if(QFile::exists(a.applicationFilePath()+".bkp"))QFile::remove(a.applicationFilePath()+".bkp");
#endif
a.setWindowIcon(QIcon(":/Resources/QtBitcoinTrader.png"));
QFile *lockFile=0;
{
QNetworkProxy proxy;
QList<QNetworkProxy> proxyList=QNetworkProxyFactory::systemProxyForQuery(QNetworkProxyQuery(QUrl("https://")));
//.........这里部分代码省略.........
开发者ID:285757854,项目名称:QtBitcoinTrader,代码行数:101,代码来源:main.cpp
示例10: text_more_shift_control_space
void DrawPathTool::updateStatusText()
{
QString text;
static const QString text_more_shift_control_space(MapEditorTool::tr("More: %1, %2, %3").arg(ModifierKey::shift(), ModifierKey::control(), ModifierKey::space()));
static const QString text_more_shift_space(MapEditorTool::tr("More: %1, %2").arg(ModifierKey::shift(), ModifierKey::space()));
static const QString text_more_control_space(MapEditorTool::tr("More: %1, %2").arg(ModifierKey::control(), ModifierKey::space()));
QString text_more(text_more_shift_control_space);
if (editingInProgress() && preview_path && preview_path->getCoordinateCount() >= 2)
{
//Q_ASSERT(!preview_path->isDirty());
float length = map()->getScaleDenominator() * preview_path->parts().front().path_coords.back().clen * 0.001f;
text += tr("<b>Length:</b> %1 m ").arg(QLocale().toString(length, 'f', 1));
text += "| ";
}
if (draw_dash_points && !is_helper_tool)
text += DrawLineAndAreaTool::tr("<b>Dash points on.</b> ") + "| ";
if (!editingInProgress())
{
if (shift_pressed)
{
text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Snap or append to existing objects. ").arg(ModifierKey::shift());
text_more = text_more_control_space;
}
else if (ctrl_pressed)
{
text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Pick direction from existing objects. ").arg(ModifierKey::control());
text_more = text_more_shift_space;
}
else
{
text += tr("<b>Click</b>: Start a straight line. <b>Drag</b>: Start a curve. ");
// text += DrawLineAndAreaTool::tr(draw_dash_points ? "<b>%1</b> Disable dash points. " : "<b>%1</b>: Enable dash points. ").arg(ModifierKey::space());
}
}
else
{
if (shift_pressed)
{
text += DrawLineAndAreaTool::tr("<b>%1+Click</b>: Snap to existing objects. ").arg(ModifierKey::shift());
text += tr("<b>%1+Drag</b>: Follow existing objects. ").arg(ModifierKey::shift());
text_more = text_more_control_space;
}
else if (ctrl_pressed && angle_helper->isActive())
{
text += DrawLineAndAreaTool::tr("<b>%1</b>: Fixed angles. ").arg(ModifierKey::control());
text_more = text_more_shift_space;
}
else
{
text += tr("<b>Click</b>: Draw a straight line. <b>Drag</b>: Draw a curve. "
"<b>Right or double click</b>: Finish the path. "
"<b>%1</b>: Close the path. ").arg(ModifierKey::return_key());
text += DrawLineAndAreaTool::tr("<b>%1</b>: Undo last point. ").arg(ModifierKey::backspace());
text += MapEditorTool::tr("<b>%1</b>: Abort. ").arg(ModifierKey::escape());
}
}
text += "| " + text_more;
setStatusBarText(text);
}
开发者ID:kjetilk,项目名称:mapper,代码行数:64,代码来源:tool_draw_path.cpp
示例11: toHtml
QString TrackLayer::toHtml()
{
QString S;
int totSegment = 0;
int totSec = 0;
qreal totDistance = 0;
for (int i=0; i < size(); ++i) {
if (TrackSegment* S = CAST_SEGMENT(get(i))) {
totSegment++;
totSec += S->duration();
totDistance += S->distance();
}
}
S += "<i>"+QApplication::translate("TrackLayer", "# of track segments")+": </i>" + QApplication::translate("TrackLayer", "%1").arg(QLocale().toString(totSegment))+"<br/>";
S += "<i>"+QApplication::translate("TrackLayer", "Total distance")+": </i>" + QApplication::translate("TrackLayer", "%1 km").arg(QLocale().toString(totDistance, 'g', 3))+"<br/>";
S += "<i>"+QApplication::translate("TrackLayer", "Total duration")+": </i>" + QApplication::translate("TrackLayer", "%1h %2m").arg(QLocale().toString(totSec/3600)).arg(QLocale().toString((totSec%3600)/60))+"<br/>";
return toMainHtml().arg(S);
}
开发者ID:Harpalus,项目名称:merkaartor,代码行数:21,代码来源:Layer.cpp
示例12: QLocale
QList<QVariantMap> DatabaseManager::getStartPageSeries()
{
auto date = QDateTime::currentDateTime().date();
auto locale = QLocale(QLocale::English);
auto firstAiredStart = date.addDays(1 - date.dayOfWeek()).toString(Qt::ISODate); // Monday == 1
auto firstAiredEnd = date.addDays(7 - date.dayOfWeek()).toString(Qt::ISODate); // Sunday == 7
auto status = "Continuing";
const auto kTwelveHoursInSecs = 12 * 60 * 60;
QList<QVariantMap> series;
if (m_db.isOpen()) {
QSqlQuery query(m_db);
query.exec(QString("SELECT Series.seriesName, Series.network, Series.airsTime, Series.airsDayOfWeek, Series.status, Series.id, Episode.id, Episode.episodeName, Episode.episodeNumber, Episode.seasonNumber, Episode.firstAired, Episode.filename, Episode.overview, Episode.guestStars, Episode.writer, Episode.watched "
"FROM Series, Episode "
"WHERE Series.status = '%1' AND Episode.firstAired BETWEEN '%2' AND '%3' AND Series.id = Episode.seriesID AND Episode.seasonNumber != 0 "
"ORDER BY Episode.firstAired;").arg(status).arg(firstAiredStart).arg(firstAiredEnd));
if (query.isSelect()) {
while (query.next()) {
QVariantMap temp;
auto seriesName = query.value(0).toString();
temp["seriesName"] = seriesName;
auto network = query.value(1).toString();
temp["network"] = network;
auto airsTime = query.value(2).toString();
QTime time;
if (airsTime.contains("PM")) {
airsTime.resize(airsTime.indexOf("PM") - 1);
time = QTime::fromString(airsTime, "h:m").addSecs(kTwelveHoursInSecs);
} else {
time = QTime::fromString(airsTime, "h:m");
}
temp["airsTime"] = time.toString("h:mm");
auto airsDayOfWeek = query.value(3).toString();
temp["airsDayOfWeek"] = airsDayOfWeek;
auto status = query.value(4).toString();
temp["status"] = status;
auto id = query.value(5).toString();
temp["id"] = id;
auto episodeId = query.value(6).toString();
temp["nextEpisodeId"] = episodeId;
auto episodeName = query.value(7).toString();
episodeName.replace("''", "'");
temp["nextEpisodeName"] = episodeName;
auto episodeNumber = query.value(8).toString();
temp["nextEpisodeNumber"] = episodeNumber;
auto seasonNumber = query.value(9).toString();
temp["nextEpisodeSeasonNumber"] = seasonNumber;
auto firstAired = query.value(10).toString();
temp["nextEpisodeFirstAired"] = firstAired;
// Sometimes the series info airsDayOfWeek is wrong so lets take it from the episode directly then
auto airsDayOfWeekFromEpisode = locale.toString(QDate::fromString(firstAired, Qt::ISODate), "dddd");
temp["airsDayOfWeek"] = airsDayOfWeek == airsDayOfWeekFromEpisode ? airsDayOfWeek : airsDayOfWeekFromEpisode;
auto banner = query.value(11).toString();
temp["nextEpisodeBanner"] = banner;
auto overview = query.value(12).toString();
overview.replace("''", "'");
temp["nextEpisodeOverview"] = overview;
auto guestStars = query.value(13).toString();
temp["nextEpisodeGuestStars"] = guestStars;
auto writer = query.value(14).toString();
temp["nextEpisodeWriter"] = writer;
auto watched = query.value(15).toString();
temp["nextEpisodeWatched"] = watched;
series.append(temp);
}
}
}
return series;
}
开发者ID:joonne,项目名称:harbour-sailseries,代码行数:95,代码来源:databasemanager.cpp
示例13: SettingsPage
BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
: SettingsPage(dialog), ui_(new Ui_BehaviourSettingsPage) {
ui_->setupUi(this);
connect(ui_->b_show_tray_icon_, SIGNAL(toggled(bool)),
SLOT(ShowTrayIconToggled(bool)));
ui_->doubleclick_addmode->setItemData(0, MainWindow::AddBehaviour_Append);
ui_->doubleclick_addmode->setItemData(1, MainWindow::AddBehaviour_Load);
ui_->doubleclick_addmode->setItemData(2, MainWindow::AddBehaviour_OpenInNew);
ui_->doubleclick_addmode->setItemData(3, MainWindow::AddBehaviour_Enqueue);
ui_->doubleclick_playmode->setItemData(0, MainWindow::PlayBehaviour_Never);
ui_->doubleclick_playmode->setItemData(1,
MainWindow::PlayBehaviour_IfStopped);
ui_->doubleclick_playmode->setItemData(2, MainWindow::PlayBehaviour_Always);
ui_->doubleclick_playlist_addmode->setItemData(
0, MainWindow::PlaylistAddBehaviour_Play);
ui_->doubleclick_playlist_addmode->setItemData(
1, MainWindow::PlaylistAddBehaviour_Enqueue);
ui_->menu_playmode->setItemData(0, MainWindow::PlayBehaviour_Never);
ui_->menu_playmode->setItemData(1, MainWindow::PlayBehaviour_IfStopped);
ui_->menu_playmode->setItemData(2, MainWindow::PlayBehaviour_Always);
ui_->menu_previousmode->setItemData(0, Player::PreviousBehaviour_DontRestart);
ui_->menu_previousmode->setItemData(1, Player::PreviousBehaviour_Restart);
// Populate the language combo box. We do this by looking at all the
// compiled in translations.
QDir dir(":/translations/");
QStringList codes(dir.entryList(QStringList() << "*.qm"));
QRegExp lang_re("^clementine_(.*).qm$");
for (const QString& filename : codes) {
// The regex captures the "ru" from "clementine_ru.qm"
if (!lang_re.exactMatch(filename)) continue;
QString code = lang_re.cap(1);
QString lookup_code = QString(code)
.replace("@latin", "_Latn")
.replace("_CN", "_Hans_CN")
.replace("_TW", "_Hant_TW");
QString language_name =
QLocale::languageToString(QLocale(lookup_code).language());
#if QT_VERSION >= 0x040800
QString native_name = QLocale(lookup_code).nativeLanguageName();
if (!native_name.isEmpty()) {
language_name = native_name;
}
#endif
QString name = QString("%1 (%2)").arg(language_name, code);
language_map_[name] = code;
}
language_map_["English (en)"] = "en";
// Sort the names and show them in the UI
QStringList names = language_map_.keys();
qStableSort(names.begin(), names.end(), LocaleAwareCompare);
ui_->language->addItems(names);
#ifdef Q_OS_DARWIN
ui_->b_show_tray_icon_->setEnabled(false);
ui_->startup_group_->setEnabled(false);
#endif
}
开发者ID:Chemrat,项目名称:Clementine,代码行数:68,代码来源:behavioursettingspage.cpp
示例14: updateButton
void updateButton()
{
mDateButton->setText(QLocale().toString(mDate, QLocale::ShortFormat));
}
开发者ID:KDE,项目名称:gwenview,代码行数:4,代码来源:datewidget.cpp
示例15: if
//.........这里部分代码省略.........
const QColor secondColor(249, 249, 228, 150);
QColor color = fisrtColor;
//for (int i = start; i < end+1; ++i)
while (it != endIt) {
/*if (i>progressBarIndex)
{
progress.setValue(i);
progressBarIndex += step;
if (!firstTimeUpdate)
{
searchTable->setUpdatesEnabled(false);
firstTimeUpdate = true;
}
}*/
if (count > 300) {
progress.setValue(i - start);
}
if (progress.wasCanceled()) {
break;
}
int poemId = it.key();// tmpList.at(i);
//GanjoorPoem poem = SaagharWidget::ganjoorDataBase->getPoem(poemId/*resultList.at(i)*/);
//poem._HighlightText = phrase;
//we need a modified verion of showParentCategory
//showParentCategory(SaagharWidget::ganjoorDataBase->getCategory(poem._CatID));
//adding Numbers
QLocale persianLocal = QLocale(QLocale::Persian, QLocale::Iran);
persianLocal.setNumberOptions(QLocale::OmitGroupSeparator);
QString localizedNumber = persianLocal.toString(i + 1);
QTableWidgetItem* numItem = new QTableWidgetItem(localizedNumber);
numItem->setFlags(Qt::NoItemFlags /*Qt::ItemIsEnabled*/);
searchTable->setItem(i - start, 0, numItem);
QString firstVerse = "", poemTiltle = "", poetName = "";
//QStringList verseData = resultList.value(poemId, "").split("|", QString::SkipEmptyParts);
QStringList verseData = it.value().split("|", QString::SkipEmptyParts);
if (verseData.size() == 3) {
firstVerse = verseData.at(0);
firstVerse.remove("verseText=");
poemTiltle = verseData.at(1);
poemTiltle.remove("poemTitle=");
poetName = verseData.at(2);
poetName.remove("poetName=");
}
//add Items
QString snippedPoemTitle = QGanjoorDbBrowser::snippedText(poemTiltle, "", 0, 5, true);
if (sectionName == tr("All") || sectionName == tr("Titles")) {
snippedPoemTitle.prepend(poetName + ": ");
}
QTableWidgetItem* poemItem = new QTableWidgetItem(snippedPoemTitle);
poemItem->setFlags(Qt::ItemIsEnabled);
poemItem->setData(Qt::UserRole, "PoemID=" + QString::number(poemId));
int tmpWidth = searchTable->fontMetrics().boundingRect(snippedPoemTitle).width();
开发者ID:mkhoeini,项目名称:Saaghar,代码行数:67,代码来源:searchresultwidget.cpp
示例16: JourneyResultList
void Parser131500ComAu::parseSearchJourney(QNetworkReply *networkReply)
{
lastJourneyResultList = new JourneyResultList();
QBuffer *filebuffer = new QBuffer();
filebuffer->setData(networkReply->readAll());
QRegExp regexp = QRegExp("<div class=\"midcolumn3\">(.*)</div>(.*)</div>(.*)<div id=\"righttools\">");
regexp.setMinimal(true);
regexp.indexIn(filebuffer->buffer());
QString element = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><html xmlns=\"http://www.w3.org/1999/xhtml\">\n<body>\n" + regexp.cap(0) + "\n</div></body>\n</html>\n";
QRegExp imgReg = QRegExp("icon_(.*)_s.gif\" />");
imgReg.setMinimal(true);
element.replace(imgReg, "icon_" + QString("\\1") + "_s.gif\" />" + QString("\\1"));
element.replace("am+", "am");
element.replace("pm+", "pm");
//qDebug()<<element;
QBuffer readBuffer;
readBuffer.setData(element.toAscii());
readBuffer.open(QIODevice::ReadOnly);
QXmlQuery query;
query.bindVariable("path", &readBuffer);
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path external; doc($path)/html/body/div/div/table/tbody/tr/td[@id='header2']/string()");
QStringList departResult;
if (!query.evaluateTo(&departResult))
{
qDebug() << "parser131500ComAu::getJourneyData - Query 1 Failed";
}
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path external; doc($path)/html/body/div/div/table/tbody/tr/td[@id='header3']/string()");
QStringList arriveResult;
if (!query.evaluateTo(&arriveResult))
{
qDebug() << "parser131500ComAu::getJourneyData - Query 2 Failed";
}
query.setQuery("declare default element namespace \"http://www.w3.org/1999/xhtml\"; declare variable $path e
|
请发表评论