本文整理汇总了C++中Q_ASSERT_X函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_ASSERT_X函数的具体用法?C++ Q_ASSERT_X怎么用?C++ Q_ASSERT_X使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_ASSERT_X函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QRegExpValidator
IbanValidator::IbanValidator(QObject *parent) : QRegExpValidator(parent) {
// initialze templates, copied from http://en.wikipedia.org/wiki/International_Bank_Account_Number
// templates could also be read from an external text file or from a database
// LibreOffice calc (German locale) formula to create the entries from the copied text of wikipedia:
// ="ibanTemplate["&ZEILE()-2&"].country = QLatin1String("""&A21&"""); ibanTemplate["&ZEILE()-2&"].length = "&B21&"; ibanTemplate["&ZEILE()-2&"].format = QLatin1String("""&C21&"""); ibanTemplate["&ZEILE()-2&"].codes = QLatin1String("""&LINKS(D21;2)&""");"
QList<IbanTemplate> ibanTemplate;
ibanTemplate.reserve(56);
for (int i(0); i < 56; ++i) ibanTemplate.append(IbanTemplate());
ibanTemplate[0].country = QLatin1String("Albania"); ibanTemplate[0].length = 28; ibanTemplate[0].format = QLatin1String("8n, 16c"); ibanTemplate[0].codes = QLatin1String("AL");
ibanTemplate[1].country = QLatin1String("Andorra"); ibanTemplate[1].length = 24; ibanTemplate[1].format = QLatin1String("8n,12c"); ibanTemplate[1].codes = QLatin1String("AD");
ibanTemplate[2].country = QLatin1String("Austria"); ibanTemplate[2].length = 20; ibanTemplate[2].format = QLatin1String("16n"); ibanTemplate[2].codes = QLatin1String("AT");
ibanTemplate[3].country = QLatin1String("Belgium"); ibanTemplate[3].length = 16; ibanTemplate[3].format = QLatin1String("12n"); ibanTemplate[3].codes = QLatin1String("BE");
ibanTemplate[4].country = QLatin1String("Bahrain"); ibanTemplate[4].length = 22; ibanTemplate[4].format = QLatin1String("4a,14c"); ibanTemplate[4].codes = QLatin1String("BH");
ibanTemplate[5].country = QLatin1String("Bosnia and Herzegovina"); ibanTemplate[5].length = 20; ibanTemplate[5].format = QLatin1String("16n"); ibanTemplate[5].codes = QLatin1String("BA");
ibanTemplate[6].country = QLatin1String("Bulgaria"); ibanTemplate[6].length = 22; ibanTemplate[6].format = QLatin1String("4a,6n,8c"); ibanTemplate[6].codes = QLatin1String("BG");
ibanTemplate[7].country = QLatin1String("Croatia"); ibanTemplate[7].length = 21; ibanTemplate[7].format = QLatin1String("17n"); ibanTemplate[7].codes = QLatin1String("HR");
ibanTemplate[8].country = QLatin1String("Cyprus"); ibanTemplate[8].length = 28; ibanTemplate[8].format = QLatin1String("8n,16c"); ibanTemplate[8].codes = QLatin1String("CY");
ibanTemplate[9].country = QLatin1String("Czech Republic"); ibanTemplate[9].length = 24; ibanTemplate[9].format = QLatin1String("20n"); ibanTemplate[9].codes = QLatin1String("CZ");
ibanTemplate[10].country = QLatin1String("Denmark"); ibanTemplate[10].length = 18; ibanTemplate[10].format = QLatin1String("14n"); ibanTemplate[10].codes = QLatin1String("DK");
ibanTemplate[11].country = QLatin1String("Dominican Republic"); ibanTemplate[11].length = 28; ibanTemplate[11].format = QLatin1String("4a,20n"); ibanTemplate[11].codes = QLatin1String("DO");
ibanTemplate[12].country = QLatin1String("Estonia"); ibanTemplate[12].length = 20; ibanTemplate[12].format = QLatin1String("16n"); ibanTemplate[12].codes = QLatin1String("EE");
ibanTemplate[13].country = QLatin1String("Faroe Islands"); ibanTemplate[13].length = 18; ibanTemplate[13].format = QLatin1String("14n"); ibanTemplate[13].codes = QLatin1String("FO");
ibanTemplate[14].country = QLatin1String("Finland"); ibanTemplate[14].length = 18; ibanTemplate[14].format = QLatin1String("14n"); ibanTemplate[14].codes = QLatin1String("FI");
ibanTemplate[15].country = QLatin1String("France"); ibanTemplate[15].length = 27; ibanTemplate[15].format = QLatin1String("10n,11c,2n"); ibanTemplate[15].codes = QLatin1String("FR, TF, PF, YT, NC, PM, WF");
ibanTemplate[16].country = QLatin1String("Georgia"); ibanTemplate[16].length = 22; ibanTemplate[16].format = QLatin1String("2c,16n"); ibanTemplate[16].codes = QLatin1String("GE");
ibanTemplate[17].country = QLatin1String("Germany"); ibanTemplate[17].length = 22; ibanTemplate[17].format = QLatin1String("18n"); ibanTemplate[17].codes = QLatin1String("DE");
ibanTemplate[18].country = QLatin1String("Gibraltar"); ibanTemplate[18].length = 23; ibanTemplate[18].format = QLatin1String("4a,15c"); ibanTemplate[18].codes = QLatin1String("GI");
ibanTemplate[19].country = QLatin1String("Greece"); ibanTemplate[19].length = 27; ibanTemplate[19].format = QLatin1String("7n,16c"); ibanTemplate[19].codes = QLatin1String("GR");
ibanTemplate[20].country = QLatin1String("Greenland[Note 1]"); ibanTemplate[20].length = 18; ibanTemplate[20].format = QLatin1String("14n"); ibanTemplate[20].codes = QLatin1String("GL");
ibanTemplate[21].country = QLatin1String("Hungary"); ibanTemplate[21].length = 28; ibanTemplate[21].format = QLatin1String("24n"); ibanTemplate[21].codes = QLatin1String("HU");
ibanTemplate[22].country = QLatin1String("Iceland"); ibanTemplate[22].length = 26; ibanTemplate[22].format = QLatin1String("22n"); ibanTemplate[22].codes = QLatin1String("IS");
ibanTemplate[23].country = QLatin1String("Ireland"); ibanTemplate[23].length = 22; ibanTemplate[23].format = QLatin1String("4c,14n"); ibanTemplate[23].codes = QLatin1String("IE");
ibanTemplate[24].country = QLatin1String("Israel"); ibanTemplate[24].length = 23; ibanTemplate[24].format = QLatin1String("19n"); ibanTemplate[24].codes = QLatin1String("IL");
ibanTemplate[25].country = QLatin1String("Italy"); ibanTemplate[25].length = 27; ibanTemplate[25].format = QLatin1String("1a,10n,12c"); ibanTemplate[25].codes = QLatin1String("IT");
ibanTemplate[26].country = QLatin1String("Kazakhstan"); ibanTemplate[26].length = 20; ibanTemplate[26].format = QLatin1String("3n,3c,10n"); ibanTemplate[26].codes = QLatin1String("KZ");
ibanTemplate[27].country = QLatin1String("Kuwait"); ibanTemplate[27].length = 30; ibanTemplate[27].format = QLatin1String("4a, 22n"); ibanTemplate[27].codes = QLatin1String("KW");
ibanTemplate[28].country = QLatin1String("Latvia"); ibanTemplate[28].length = 21; ibanTemplate[28].format = QLatin1String("4a,13c"); ibanTemplate[28].codes = QLatin1String("LV");
ibanTemplate[29].country = QLatin1String("Lebanon"); ibanTemplate[29].length = 28; ibanTemplate[29].format = QLatin1String("4n,20c"); ibanTemplate[29].codes = QLatin1String("LB");
ibanTemplate[30].country = QLatin1String("Liechtenstein"); ibanTemplate[30].length = 21; ibanTemplate[30].format = QLatin1String("5n,12c"); ibanTemplate[30].codes = QLatin1String("LI");
ibanTemplate[31].country = QLatin1String("Lithuania"); ibanTemplate[31].length = 20; ibanTemplate[31].format = QLatin1String("16n"); ibanTemplate[31].codes = QLatin1String("LT");
ibanTemplate[32].country = QLatin1String("Luxembourg"); ibanTemplate[32].length = 20; ibanTemplate[32].format = QLatin1String("3n,13c"); ibanTemplate[32].codes = QLatin1String("LU");
ibanTemplate[33].country = QLatin1String("Macedonia"); ibanTemplate[33].length = 19; ibanTemplate[33].format = QLatin1String("3n,10c,2n"); ibanTemplate[33].codes = QLatin1String("MK");
ibanTemplate[34].country = QLatin1String("Malta"); ibanTemplate[34].length = 31; ibanTemplate[34].format = QLatin1String("4a,5n,18c"); ibanTemplate[34].codes = QLatin1String("MT");
ibanTemplate[35].country = QLatin1String("Mauritania"); ibanTemplate[35].length = 27; ibanTemplate[35].format = QLatin1String("23n"); ibanTemplate[35].codes = QLatin1String("MR");
ibanTemplate[36].country = QLatin1String("Mauritius"); ibanTemplate[36].length = 30; ibanTemplate[36].format = QLatin1String("4a,19n,3a"); ibanTemplate[36].codes = QLatin1String("MU");
ibanTemplate[37].country = QLatin1String("Monaco"); ibanTemplate[37].length = 27; ibanTemplate[37].format = QLatin1String("10n,11c,2n"); ibanTemplate[37].codes = QLatin1String("MC");
ibanTemplate[38].country = QLatin1String("Montenegro"); ibanTemplate[38].length = 22; ibanTemplate[38].format = QLatin1String("18n"); ibanTemplate[38].codes = QLatin1String("ME");
ibanTemplate[39].country = QLatin1String("Netherlands[Note 3]"); ibanTemplate[39].length = 18; ibanTemplate[39].format = QLatin1String("4a,10n"); ibanTemplate[39].codes = QLatin1String("NL");
ibanTemplate[40].country = QLatin1String("Norway"); ibanTemplate[40].length = 15; ibanTemplate[40].format = QLatin1String("11n"); ibanTemplate[40].codes = QLatin1String("NO");
ibanTemplate[41].country = QLatin1String("Poland"); ibanTemplate[41].length = 28; ibanTemplate[41].format = QLatin1String("24n"); ibanTemplate[41].codes = QLatin1String("PL");
ibanTemplate[42].country = QLatin1String("Portugal"); ibanTemplate[42].length = 25; ibanTemplate[42].format = QLatin1String("21n"); ibanTemplate[42].codes = QLatin1String("PT");
ibanTemplate[43].country = QLatin1String("Romania"); ibanTemplate[43].length = 24; ibanTemplate[43].format = QLatin1String("4a,16c"); ibanTemplate[43].codes = QLatin1String("RO");
ibanTemplate[44].country = QLatin1String("San Marino"); ibanTemplate[44].length = 27; ibanTemplate[44].format = QLatin1String("1a,10n,12c"); ibanTemplate[44].codes = QLatin1String("SM");
ibanTemplate[45].country = QLatin1String("Saudi Arabia"); ibanTemplate[45].length = 24; ibanTemplate[45].format = QLatin1String("2n,18c"); ibanTemplate[45].codes = QLatin1String("SA");
ibanTemplate[46].country = QLatin1String("Serbia"); ibanTemplate[46].length = 22; ibanTemplate[46].format = QLatin1String("18n"); ibanTemplate[46].codes = QLatin1String("RS");
ibanTemplate[47].country = QLatin1String("Slovakia"); ibanTemplate[47].length = 24; ibanTemplate[47].format = QLatin1String("20n"); ibanTemplate[47].codes = QLatin1String("SK");
ibanTemplate[48].country = QLatin1String("Slovenia"); ibanTemplate[48].length = 19; ibanTemplate[48].format = QLatin1String("15n"); ibanTemplate[48].codes = QLatin1String("SI");
ibanTemplate[49].country = QLatin1String("Spain"); ibanTemplate[49].length = 24; ibanTemplate[49].format = QLatin1String("20n"); ibanTemplate[49].codes = QLatin1String("ES");
ibanTemplate[50].country = QLatin1String("Sweden"); ibanTemplate[50].length = 24; ibanTemplate[50].format = QLatin1String("20n"); ibanTemplate[50].codes = QLatin1String("SE");
ibanTemplate[51].country = QLatin1String("Switzerland"); ibanTemplate[51].length = 21; ibanTemplate[51].format = QLatin1String("5n,12c"); ibanTemplate[51].codes = QLatin1String("CH");
ibanTemplate[52].country = QLatin1String("Tunisia"); ibanTemplate[52].length = 24; ibanTemplate[52].format = QLatin1String("20n"); ibanTemplate[52].codes = QLatin1String("TN");
ibanTemplate[53].country = QLatin1String("Turkey"); ibanTemplate[53].length = 26; ibanTemplate[53].format = QLatin1String("5n,17c"); ibanTemplate[53].codes = QLatin1String("TR");
ibanTemplate[54].country = QLatin1String("United Arab Emirates"); ibanTemplate[54].length = 23; ibanTemplate[54].format = QLatin1String("3n,16n"); ibanTemplate[54].codes = QLatin1String("AE");
ibanTemplate[55].country = QLatin1String("United Kingdom[Note 4]"); ibanTemplate[55].length = 22; ibanTemplate[55].format = QLatin1String("4a,14n"); ibanTemplate[55].codes = QLatin1String("GB");
// create reg exp from templates
QStringList regexp_all;
foreach (IbanTemplate t, ibanTemplate){
QString regexp1;
// standardized first block: country codes (France uses more than one) and 2 checksum digits
regexp1.append(QLatin1String("("))
.append(QRegExp::escape(t.codes.remove(QLatin1Char(' '))).replace(QLatin1Char(','), QLatin1Char('|')))
.append(QLatin1String(")"))
.append(QLatin1String("\\d\\d"));
// BBAN fields
QStringList bbanFields = t.format.split(QLatin1Char(','));
foreach (QString bbanField, bbanFields){
bbanField.remove(QLatin1Char(' '));
Q_ASSERT_X(bbanField.left(bbanField.length() - 1).toInt() > 0, "BBAN format: count is wrong for IBAN", t.country.toLatin1());
QChar formatSymbol(bbanField.at(bbanField.length() - 1));
if (formatSymbol == QLatin1Char('n')) regexp1.append(QLatin1String("[0-9]"));
else if (formatSymbol == QLatin1Char('a')) regexp1.append(QLatin1String("[A-Z]"));
else if (formatSymbol == QLatin1Char('c')) regexp1.append(QLatin1String("[A-Z0-9]"));
else Q_ASSERT_X(false, "BBAN format: format symbol is wrong for IBAN", t.country.toLatin1());
regexp1.append(QLatin1String("{")).append(bbanField.left(bbanField.length() - 1)).append(QLatin1String("}"));}
开发者ID:Al-,项目名称:IbanValidator,代码行数:84,代码来源:ibanvalidator.cpp
示例2: Q_ASSERT_X
void PropertyConfigurator::configureGlobalSettings(const Properties &rProperties,
LoggerRepository *pLoggerRepository) const
{
Q_ASSERT_X(pLoggerRepository, "PropertyConfigurator::configureGlobalSettings()", "pLoggerRepository must not be null.");
const QLatin1String key_reset("log4j.reset");
const QLatin1String key_debug("log4j.Debug");
const QLatin1String key_config_debug("log4j.configDebug");
const QLatin1String key_threshold("log4j.threshold");
const QLatin1String key_handle_qt_messages("log4j.handleQtMessages");
// Test each global setting and set it
// - Reset: log4j.reset
// - Debug: log4j.Debug, log4j.configDebug
// - Threshold: log4j.threshold
// - Handle Qt Messages: log4j.handleQtMessages
// Reset
QString value = rProperties.property(key_reset);
if (!value.isEmpty() && OptionConverter::toBoolean(value, false))
{
// Use LogManager and not pLoggerRepository to reset internal
// logging.
LogManager::resetConfiguration();
logger()->debug("Reset configuration");
}
// Debug
value = rProperties.property(key_debug);
if (value.isNull())
{
value = rProperties.property(key_config_debug);
if (!value.isNull())
logger()->warn("[%1] is deprecated. Use [%2] instead.", key_config_debug, key_debug);
}
if (!value.isNull())
{
// Don't use OptionConverter::toLevel(). Invalid level string is a valid setting
bool ok;
Level level = Level::fromString(value, &ok);
if (!ok)
level = Level::DEBUG_INT;
LogManager::logLogger()->setLevel(level);
logger()->debug("Set level for Log4Qt logging to %1",
LogManager::logLogger()->level().toString());
}
// Threshold
value = rProperties.property(key_threshold);
if (!value.isNull())
{
pLoggerRepository->setThreshold(OptionConverter::toLevel(value, Level::ALL_INT));
logger()->debug("Set threshold for LoggerRepository to %1",
pLoggerRepository->threshold().toString());
}
// Handle Qt messages
value = rProperties.property(key_handle_qt_messages);
if (!value.isNull())
{
LogManager::setHandleQtMessages(OptionConverter::toBoolean(value, false));
logger()->debug("Set handling of Qt messages LoggerRepository to %1",
QVariant(LogManager::handleQtMessages()).toString());
}
}
开发者ID:Akers,项目名称:Qtqq,代码行数:65,代码来源:propertyconfigurator.cpp
示例3: qWarning
/*!
\internal
*/
void CapsuleMesh::createGeometry(bool bForce)
{
// Create a new geometry node for this level of detail if necessary.
QGLSceneNode *geometry = 0;
QMap<int, QGLSceneNode *>::iterator It = d->lodGeometry.find(d->lod);
if (It != d->lodGeometry.end())
geometry = *It;
if (geometry && bForce) {
if (d->currentCapsule)
d->topNode->removeNode(d->currentCapsule);
d->currentCapsule = 0;
d->lodGeometry.erase(It);
geometry->setParent(0);
delete geometry;
geometry = 0;
}
if (!geometry) {
QGLBuilder builder;
// For the cylinder
int facets = 4 * (1 << d->lod);
int layers = (1 << d->lod) - 1;
// For the spheres
int divisions = d->lod;
// Sanity check - the height of the capsule must not be less than its
// diameter. A minimal capsule is a sphere - where diameter == height.
if (d->length < 2.0f * d->radius)
{
qWarning() << "Length of capsule must exceed its diameter"
<< " - correcting length.";
d->length = 2.0f * d->radius;
}
float diameter = d->radius+d->radius;
float cylinderHeight = d->length - diameter;
float offset = cylinderHeight/2.0f;
builder << QGL::Faceted;
QGLSceneNode *s = 0;
s = builder.newNode();
s->setObjectName(QLatin1String("Cylinder"));
builder << QGLCylinder(diameter, diameter, cylinderHeight,
facets, layers, false, false);
s = builder.newNode();
s->setObjectName(QLatin1String("LeftEndCap"));
builder << QGLDome(diameter, divisions, false);
QMatrix4x4 translateMatrix;
translateMatrix.setToIdentity();
translateMatrix.rotate(180.0f, 0.0f, 1.0f, 0.0f);
translateMatrix.translate(0.0f, 0.0f, offset);
builder.currentNode()->setLocalTransform(translateMatrix);
s = builder.newNode();
s->setObjectName(QLatin1String("RightEndCap"));
builder << QGLDome(diameter, divisions, false);
translateMatrix.setToIdentity();
translateMatrix.translate(0.0f, 0.0f, offset);
builder.currentNode()->setLocalTransform(translateMatrix);
geometry = builder.finalizedSceneNode();
geometry->setParent(this);
d->lodGeometry.insert(d->lod, geometry);
}
Q_ASSERT_X(geometry != 0, Q_FUNC_INFO, "Could not create/find geometry!");
if (d->currentCapsule != geometry)
{
if (d->currentCapsule)
d->topNode->removeNode(d->currentCapsule);
d->topNode->addNode(geometry);
d->currentCapsule = geometry;
}
if (!d->sceneSet)
{
setScene(new CapsuleScene(d->topNode));
d->sceneSet = true;
}
}
开发者ID:Distrotech,项目名称:qt3d,代码行数:85,代码来源:capsulemesh.cpp
示例4: QMainWindow
MainWindow::MainWindow() : QMainWindow(),
actionNextDive(0),
actionPreviousDive(0),
helpView(0),
state(VIEWALL),
survey(0)
{
Q_ASSERT_X(m_Instance == NULL, "MainWindow", "MainWindow recreated!");
m_Instance = this;
ui.setupUi(this);
read_hashes();
// Define the States of the Application Here, Currently the states are situations where the different
// widgets will change on the mainwindow.
// for the "default" mode
MainTab *mainTab = new MainTab();
DiveListView *diveListView = new DiveListView();
ProfileWidget2 *profileWidget = new ProfileWidget2();
#ifndef NO_MARBLE
GlobeGPS *globeGps = new GlobeGPS();
#else
QWidget *globeGps = NULL;
#endif
PlannerSettingsWidget *plannerSettings = new PlannerSettingsWidget();
DivePlannerWidget *plannerWidget = new DivePlannerWidget();
PlannerDetails *plannerDetails = new PlannerDetails();
LocationInformationWidget *locationInformation = new LocationInformationWidget();
// what is a sane order for those icons? we should have the ones the user is
// most likely to want towards the top so they are always visible
// and the ones that someone likely sets and then never touches again towards the bottom
profileToolbarActions << ui.profCalcCeiling << ui.profCalcAllTissues << // start with various ceilings
ui.profIncrement3m << ui.profDcCeiling <<
ui.profPhe << ui.profPn2 << ui.profPO2 << // partial pressure graphs
ui.profRuler << ui.profScaled << // measuring and scaling
ui.profTogglePicture << ui.profTankbar <<
ui.profMod << ui.profNdl_tts << // various values that a user is either interested in or not
ui.profEad << ui.profSAC <<
ui.profHR << // very few dive computers support this
ui.profTissues; // maybe less frequently used
QToolBar *toolBar = new QToolBar();
Q_FOREACH (QAction *a, profileToolbarActions)
toolBar->addAction(a);
toolBar->setOrientation(Qt::Vertical);
toolBar->setIconSize(QSize(24,24));
QWidget *profileContainer = new QWidget();
QHBoxLayout *profLayout = new QHBoxLayout();
profLayout->setSpacing(0);
profLayout->setMargin(0);
profLayout->setContentsMargins(0,0,0,0);
profLayout->addWidget(toolBar);
profLayout->addWidget(profileWidget);
profileContainer->setLayout(profLayout);
registerApplicationState("Default", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("AddDive", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("EditDive", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("PlanDive", plannerWidget, profileContainer, plannerSettings, plannerDetails );
registerApplicationState("EditPlannedDive", plannerWidget, profileContainer, diveListView, globeGps );
registerApplicationState("EditDiveSite",locationInformation, profileContainer, diveListView, globeGps );
setApplicationState("Default");
ui.multiFilter->hide();
setWindowIcon(QIcon(":subsurface-icon"));
if (!QIcon::hasThemeIcon("window-close")) {
QIcon::setThemeName("subsurface");
}
connect(dive_list(), SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int)));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(update()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(reloadHeaderActions()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), information(), SLOT(updateDiveInfo()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerWidget(), SLOT(settingsChanged()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), divePlannerSettingsWidget(), SLOT(settingsChanged()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), TankInfoModel::instance(), SLOT(update()));
connect(ui.actionRecent1, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent2, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent3, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(ui.actionRecent4, SIGNAL(triggered(bool)), this, SLOT(recentFileTriggered(bool)));
connect(information(), SIGNAL(addDiveFinished()), graphics(), SLOT(setProfileState()));
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
connect(mainTab, SIGNAL(requestDiveSiteEdit(uint32_t)), this, SLOT(enableDiveSiteEdit(uint32_t)));
connect(locationInformation, SIGNAL(informationManagementEnded()), this, SLOT(setDefaultState()));
connect(locationInformation, SIGNAL(informationManagementEnded()), information(), SLOT(showLocation()));
connect(locationInformation, SIGNAL(coordinatesChanged()), globe(), SLOT(repopulateLabels()));
#ifdef NO_PRINTING
plannerDetails->printPlan()->hide();
ui.menuFile->removeAction(ui.actionPrint);
#endif
ui.mainErrorMessage->hide();
//.........这里部分代码省略.........
开发者ID:AddictXQ,项目名称:subsurface,代码行数:101,代码来源:mainwindow.cpp
示例5: qDBusPropertyGet
QDBusMessage qDBusPropertyGet(const QDBusConnectionPrivate::ObjectTreeNode &node,
const QDBusMessage &msg)
{
Q_ASSERT(msg.arguments().count() == 2);
Q_ASSERT_X(!node.obj || QThread::currentThread() == node.obj->thread(),
"QDBusConnection: internal threading error",
"function called for an object that is in another thread!!");
QString interface_name = msg.arguments().at(0).toString();
QByteArray property_name = msg.arguments().at(1).toString().toUtf8();
QDBusAdaptorConnector *connector;
QVariant value;
bool interfaceFound = false;
if (node.flags & QDBusConnection::ExportAdaptors &&
(connector = qDBusFindAdaptorConnector(node.obj))) {
// find the class that implements interface_name or try until we've found the property
// in case of an empty interface
if (interface_name.isEmpty()) {
for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(),
end = connector->adaptors.constEnd(); it != end; ++it) {
const QMetaObject *mo = it->adaptor->metaObject();
int pidx = mo->indexOfProperty(property_name);
if (pidx != -1) {
value = mo->property(pidx).read(it->adaptor);
break;
}
}
} else {
QDBusAdaptorConnector::AdaptorMap::ConstIterator it;
it = std::lower_bound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
interface_name);
if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
interfaceFound = true;
value = it->adaptor->property(property_name);
}
}
}
if (!interfaceFound && !value.isValid()
&& node.flags & (QDBusConnection::ExportAllProperties |
QDBusConnection::ExportNonScriptableProperties)) {
// try the object itself
if (!interface_name.isEmpty())
interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
if (interfaceFound) {
int pidx = node.obj->metaObject()->indexOfProperty(property_name);
if (pidx != -1) {
QMetaProperty mp = node.obj->metaObject()->property(pidx);
if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
(!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
value = mp.read(node.obj);
}
}
}
if (!value.isValid()) {
// the property was not found
if (!interfaceFound)
return interfaceNotFoundError(msg, interface_name);
return propertyNotFoundError(msg, interface_name, property_name);
}
return msg.createReply(QVariant::fromValue(QDBusVariant(value)));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:67,代码来源:qdbusinternalfilters.cpp
示例6: Q_ASSERT_X
void ResetPassword::setLogin(QString value)
{
Q_ASSERT_X(!isNull(), "ResetPassword::setLogin", "Setter call on object which isNull");
this->d->login = value;
}
开发者ID:ildus,项目名称:moodbox_aka_risovaska,代码行数:5,代码来源:resetpassword.cpp
示例7: disconnect
/*virtual*/
void AbstractItemView::setModel(QAbstractItemModel *model, AbstractViewItem *prototype)
{
if( m_model == model || !model)
return;
if (m_model) {
disconnect(m_model, SIGNAL(destroyed()),
this, SLOT(_q_modelDestroyed()));
disconnect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT( dataChanged(QModelIndex,QModelIndex)));
disconnect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(rowsInserted(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(rowsRemoved(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(columnsInserted(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(columnsAboutToBeInserted(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(columnsRemoved(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(columnsAboutToBeRemoved(QModelIndex,int,int)));
disconnect(m_model, SIGNAL(modelReset()), this, SLOT(reset()));
disconnect(m_model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));
m_model = 0;
}
setSelectionModel(0);
m_currentIndex = QModelIndex();
m_rootIndex = QModelIndex();
m_model = model;
Q_ASSERT_X(m_model->index(0,0) == m_model->index(0,0),
"AbstractItemView::setModel",
"A model should return the exact same index "
"(including its internal id/pointer) when asked for it twice in a row.");
Q_ASSERT_X(m_model->index(0,0).parent() == QModelIndex(),
"AbstractItemView::setModel",
"The parent of a top level index should be invalid");
connect(m_model, SIGNAL(destroyed()), this, SLOT(modelDestroyed()));
connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT( dataChanged(QModelIndex,QModelIndex)));
connect(m_model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int)));
connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(rowsInserted(QModelIndex,int,int)));
connect(m_model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
connect(m_model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(rowsRemoved(QModelIndex,int,int)));
connect(m_model, SIGNAL(modelReset()), this, SLOT(reset()));
connect(m_model, SIGNAL(layoutChanged()), this, SLOT(layoutChanged()));
setSelectionModel(new QItemSelectionModel(m_model));
if (prototype && m_container) {
m_container->setItemPrototype(prototype);
m_container->reset();
}
}
开发者ID:mpvader,项目名称:qt,代码行数:70,代码来源:abstractitemview.cpp
示例8: Q_ASSERT_X
/*!
The destructor.
*/
QAbstractTextureImage::~QAbstractTextureImage()
{
Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractTextureImage subclass didn't call QNode::cleanup in its destructor");
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:7,代码来源:qabstracttextureimage.cpp
示例9: Private
Private(QueueInterface *theWeaver)
: weaver(theWeaver)
{
Q_ASSERT_X(sizeof StateNames / sizeof StateNames[0] == NoOfStates, "State::Private ctor",
"Make sure to keep StateId and StateNames in sync!");
}
开发者ID:liyubo3603237,项目名称:threadweaver,代码行数:6,代码来源:state.cpp
示例10: Q_ASSERT_X
//! Access statistic with specified index to modify it.
//!
//! Statistics are accessed by integer indices.
//! A clean way to do this is to use an enum with name corresponding
//! to the name of the statistic.
double& operator [] (int index)
{
Q_ASSERT_X(index >= 0 && index < statisticCount, Q_FUNC_INFO,
"Index of a statistic out of range");
return statistics[index];
}
开发者ID:incadoi,项目名称:stellarium-1,代码行数:11,代码来源:StelRendererStatistics.hpp
示例11: switch
QVariant ToConfiguration::Editor::defaultValue(int option) const
{
switch (option)
{
case SyntaxHighlightingInt:
return QVariant((int) 0);
case EditorTypeInt:
return QVariant((int) 0);
case UseMaxTextWidthMarkBool:
return QVariant((bool) false);
case MaxTextWidthMarkInt:
return QVariant((int)75);
case KeywordUpperBool:
return QVariant((bool) false);
case ObjectNamesUpperBool:
return QVariant((bool) false);
case CodeCompleteBool:
return QVariant((bool) true);
case CompleteSortBool:
return QVariant((bool) true);
case UseEditorShortcutsBool:
return QVariant((bool) false);
case EditorShortcutsMap:
return QVariant(QMap<QString, QVariant>());
case AutoIndentBool:
return QVariant((bool) true);
case UseSpacesForIndentBool:
return QVariant((bool) false);
case TabStopInt:
return QVariant((int) 8);
case ConfTextFont:
return QVariant(QString(""));
case ConfCodeFont:
{
QFont fo;
QFont mono;
#if defined(Q_OS_WIN)
mono = QFont("Courier New", 10);
#elif defined(Q_OS_MAC)
mono = QFont("Courier", 12);
#else
// TODO
#endif
mono.setStyleHint(QFont::Monospace, QFont::NoAntialias);
fo = mono.resolve(fo);
QString fontName = fo.toString();
return QVariant(fontName);
}
case ListTextFont:
return QVariant(QString(""));
case Extensions:
return QVariant(QString("SQL (*.sql *.pkg *.pkb), Text (*.txt), All (*)"));
case EditStyleMap:
{
static toStylesMap retval;
if (!retval.isEmpty())
return QVariant::fromValue(retval);
QMetaEnum StyleNameEnum(ENUM_REF(toSyntaxAnalyzer,WordClassEnum));
QsciLexerSQL *l = new QsciLexerSQL(NULL);
for (int idx = 0; idx < StyleNameEnum.keyCount(); idx++)
{
QColor fg = l->color((int)StyleNameEnum.value(idx));
QColor bg = l->paper((int)StyleNameEnum.value(idx));
QFont fo = Utils::toStringToFont(defaultValue(ConfCodeFont).toString());
QString styleName = StyleNameEnum.key(idx);
int styleNameEnum = StyleNameEnum.value(idx);
retval.insert(styleNameEnum, toStyle(fg, bg, fo));
}
delete l;
return QVariant::fromValue(retval);
}
default:
Q_ASSERT_X( false, qPrintable(__QHERE__), qPrintable(QString("Context Editor un-registered enum value: %1").arg(option)));
return QVariant();
}
}
开发者ID:dieface,项目名称:tora,代码行数:78,代码来源:toeditorsetting.cpp
示例12: Q_ASSERT_X
void DailyRollingFileAppender::computeRollOverTime()
{
// Q_ASSERT_X(, "DailyRollingFileAppender::computeRollOverTime()", "Lock must be held by caller")
Q_ASSERT_X(!mActiveDatePattern.isEmpty(), "DailyRollingFileAppender::computeRollOverTime()", "No active date pattern");
QDateTime now = QDateTime::currentDateTime();
QDate now_date = now.date();
QTime now_time = now.time();
QDateTime start;
switch (mFrequency)
{
case MINUTELY_ROLLOVER:
{
start = QDateTime(now_date,
QTime(now_time.hour(),
now_time.minute(),
0, 0));
mRollOverTime = start.addSecs(60);
}
break;
case HOURLY_ROLLOVER:
{
start = QDateTime(now_date,
QTime(now_time.hour(),
0, 0, 0));
mRollOverTime = start.addSecs(60*60);
}
break;
case HALFDAILY_ROLLOVER:
{
int hour = now_time.hour();
if (hour >= 12)
hour = 12;
else
hour = 0;
start = QDateTime(now_date,
QTime(hour, 0, 0, 0));
mRollOverTime = start.addSecs(60*60*12);
}
break;
case DAILY_ROLLOVER:
{
start = QDateTime(now_date,
QTime(0, 0, 0, 0));
mRollOverTime = start.addDays(1);
}
break;
case WEEKLY_ROLLOVER:
{
// QT numbers the week days 1..7. The week starts on Monday.
// Change it to being numbered 0..6, starting with Sunday.
int day = now_date.dayOfWeek();
if (day == Qt::Sunday)
day = 0;
start = QDateTime(now_date,
QTime(0, 0, 0, 0)).addDays(-1 * day);
mRollOverTime = start.addDays(7);
}
break;
case MONTHLY_ROLLOVER:
{
start = QDateTime(QDate(now_date.year(),
now_date.month(),
1),
QTime(0, 0, 0, 0));
mRollOverTime = start.addMonths(1);
}
break;
default:
Q_ASSERT_X(false, "DailyRollingFileAppender::computeInterval()", "Invalid datePattern constant");
mRollOverTime = QDateTime::fromTime_t(0);
}
mRollOverSuffix = static_cast<DateTime>(start).toString(mActiveDatePattern);
Q_ASSERT_X(static_cast<DateTime>(now).toString(mActiveDatePattern) == mRollOverSuffix,
"DailyRollingFileAppender::computeRollOverTime()", "File name changes within interval");
Q_ASSERT_X(mRollOverSuffix != static_cast<DateTime>(mRollOverTime).toString(mActiveDatePattern),
"DailyRollingFileAppender::computeRollOverTime()", "File name does not change with rollover");
logger()->trace("Computing roll over time from %1: The interval start time is %2. The roll over time is %3",
now,
start,
mRollOverTime);
}
开发者ID:doo,项目名称:log4qt,代码行数:85,代码来源:dailyrollingfileappender.cpp
示例13: switch
bool BrowserNode::tool_cmd(ToolCom * com, const char * args) {
switch ((unsigned char) args[-1]) {
case applyCmd:
{
QLOG_FATAL() << Q_FUNC_INFO << "If this got called then we have a logic flaw going on and BrowserNode needs to have Q_OBJECT in it to properly catch ToolCom::Run execution result";
Q_ASSERT_X(0, "applyCmd happened", "very bad");
int runResult = ToolCom::run(args, this, FALSE, FALSE);
com->write_unsigned(runResult);
break;
}
case createCmd:
// invalid creation
com->write_id(0);
break;
case parentCmd:
if (this != BrowserView::get_project())
((BrowserNode *) parent())->write_id(com);
else
com->write_id(0);
break;
case childrenCmd:
{
unsigned v = com->api_format();
unsigned n = 0;
Q3ListViewItem * child;
for (child = firstChild(); child != 0; child = child->nextSibling())
if (!((BrowserNode *) child)->deletedp() &&
((BrowserNode *) child)->api_compatible(v))
n += 1;
com->write_unsigned(n);
for (child = firstChild(); child != 0; child = child->nextSibling())
if (!((BrowserNode *) child)->deletedp() &&
((BrowserNode *) child)->api_compatible(v))
((BrowserNode *) child)->write_id(com);
}
break;
case getDefCmd:
case getUmlDefCmd:
case getCppDefCmd:
case getJavaDefCmd:
case getPhpDefCmd:
case getPythonDefCmd:
case getIdlDefCmd:
get_data()->send_uml_def(com, this, comment);
break;
case isWritableCmd:
com->write_bool(!is_read_only);
break;
case supportFileCmd:
// goes up to the package
return ((BrowserNode *) parent())->tool_cmd(com, args);
case isOpenCmd:
com->write_bool(isOpen());
break;
case referencedByCmd:
{
BrowserNodeList targetof;
referenced_by(targetof);
// remove duplicats
targetof.sort_it();
BrowserNode * bn;
targetof.first();
while ((bn = targetof.current()) != 0)
if (bn == targetof.next())
targetof.remove();
com->write_unsigned(targetof.count());
for (bn = targetof.first(); bn != 0; bn = targetof.next())
bn->write_id(com);
}
break;
case setCoupleValueCmd:
if (is_read_only && !root_permission())
com->write_ack(FALSE);
else {
set_value(args, args + strlen(args) + 1);
package_modified();
get_data()->modified();
com->write_ack(TRUE);
}
break;
case setDescriptionCmd:
if (is_read_only && !root_permission())
com->write_ack(FALSE);
else {
set_comment(args);
package_modified();
com->write_ack(TRUE);
}
break;
case setNameCmd:
if (is_read_only && !root_permission())
com->write_ack(FALSE);
//.........这里部分代码省略.........
开发者ID:SciBoy,项目名称:douml,代码行数:101,代码来源:BrowserNode.cpp
示例14: qDBusIntrospectObject
QString qDBusIntrospectObject(const QDBusConnectionPrivate::ObjectTreeNode &node, const QString &path)
{
// object may be null
QString xml_data(QLatin1String(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE));
xml_data += QLatin1String("<node>\n");
if (node.obj) {
Q_ASSERT_X(QThread::currentThread() == node.obj->thread(),
"QDBusConnection: internal threading error",
"function called for an object that is in another thread!!");
if (node.flags & (QDBusConnection::ExportScriptableContents
| QDBusConnection::ExportNonScriptableContents)) {
// create XML for the object itself
const QMetaObject *mo = node.obj->metaObject();
for ( ; mo != &QObject::staticMetaObject; mo = mo->superClass())
xml_data += qDBusGenerateMetaObjectXml(QString(), mo, mo->superClass(),
node.flags);
}
// does this object have adaptors?
QDBusAdaptorConnector *connector;
if (node.flags & QDBusConnection::ExportAdaptors &&
(connector = qDBusFindAdaptorConnector(node.obj))) {
// trasverse every adaptor in thi
|
请发表评论