summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp30
-rw-r--r--doc/codesnippets/examples/dialogs/extension/finddialog.cpp8
-rw-r--r--doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp2
-rw-r--r--doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp4
-rw-r--r--doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp2
-rw-r--r--doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp4
-rw-r--r--doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp6
-rw-r--r--doc/codesnippets/snippets/textdocument-resources/main.cpp2
8 files changed, 29 insertions, 29 deletions
diff --git a/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp b/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp
index 5814d5f..0d5c221 100644
--- a/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp
+++ b/doc/codesnippets/examples/dialogs/classwizard/classwizard.cpp
@@ -60,14 +60,14 @@ def __init__(self, parent):
//! [3]
def accept(self):
//! [3] //! [4]
- className = self.field("className").toByteArray()
- baseClass = self.field("baseClass").toByteArray()
- macroName = self.field("macroName").toByteArray()
- baseInclude = self.field("baseInclude").toByteArray()
-
- outputDir = self.field("outputDir").toString()
- header = self.field("header").toString()
- implementation = self.field("implementation").toString()
+ className = self.field("className")
+ baseClass = self.field("baseClass")
+ macroName = self.field("macroName")
+ baseInclude = self.field("baseInclude")
+
+ outputDir = self.field("outputDir")
+ header = self.field("header")
+ implementation = self.field("implementation")
//! [4]
...
@@ -223,17 +223,17 @@ class CodeStylePage(QWizardPage):
//! [16]
def initializePage(self):
- className = self.field("className").toString()
+ className = self.field("className")
self.macroNameLineEdit.setText(className.toUpper() + "_H")
- baseClass = self.field("baseClass").toString()
+ baseClass = self.field("baseClass")
- self.includeBaseCheckBox.setChecked(not baseClass.isEmpty())
- self.includeBaseCheckBox.setEnabled(not baseClass.isEmpty())
- self.baseIncludeLabel.setEnabled(not baseClass.isEmpty())
- self.baseIncludeLineEdit.setEnabled(not baseClass.isEmpty())
+ self.includeBaseCheckBox.setChecked(len(baseClass))
+ self.includeBaseCheckBox.setEnabled(len(baseClass))
+ self.baseIncludeLabel.setEnabled(len(baseClass))
+ self.baseIncludeLineEdit.setEnabled(len(baseClass))
- if baseClass.isEmpty():
+ if not baseClass:
self.baseIncludeLineEdit.clear()
elsif QRegExp("Q[A-Z].*").exactMatch(baseClass):
baseIncludeLineEdit.setText("<" + baseClass + ">")
diff --git a/doc/codesnippets/examples/dialogs/extension/finddialog.cpp b/doc/codesnippets/examples/dialogs/extension/finddialog.cpp
index 3ccf847..d557b06 100644
--- a/doc/codesnippets/examples/dialogs/extension/finddialog.cpp
+++ b/doc/codesnippets/examples/dialogs/extension/finddialog.cpp
@@ -78,7 +78,7 @@ def __init__(self, parent):
//! [3]
connect(moreButton, SIGNAL("toggled(bool)"), extension, SLOT("setVisible(bool)"))
- QVBoxLayout *extensionLayout = QVBoxLayout
+ extensionLayout = QVBoxLayout()
extensionLayout.setMargin(0)
extensionLayout.addWidget(wholeWordsCheckBox)
extensionLayout.addWidget(backwardCheckBox)
@@ -87,17 +87,17 @@ def __init__(self, parent):
//! [3]
//! [4]
- topLeftLayout = QHBoxLayout
+ topLeftLayout = QHBoxLayout()
topLeftLayout.addWidget(label)
topLeftLayout.addWidget(lineEdit)
- leftLayout = QVBoxLayout
+ leftLayout = QVBoxLayout()
leftLayout.addLayout(topLeftLayout)
leftLayout.addWidget(caseCheckBox)
leftLayout.addWidget(fromStartCheckBox)
leftLayout.addSself.tretch(1)
- mainLayout = QGridLayout
+ mainLayout = QGridLayout()
mainLayout.setSizeConsself.traint(QLayout.SetFixedSize)
mainLayout.addLayout(leftLayout, 0, 0)
mainLayout.addWidget(buttonBox, 0, 1)
diff --git a/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp b/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp
index 5229acd..731bdd1 100644
--- a/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp
+++ b/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp
@@ -83,7 +83,7 @@ void LicenseWizard::showHelp()
{
static QString lastHelpMessage;
- QString message;
+ message = ""
switch (currentId()) {
case Page_Intro:
diff --git a/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp b/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp
index bf196ed..be048d6 100644
--- a/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp
+++ b/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp
@@ -63,9 +63,9 @@
//! [2]
//! [3]
- QString text = QInputDialog::getText(self, self.tr("QInputDialog().getText()"),
+ text = QInputDialog::getText(self, self.tr("QInputDialog().getText()"),
self.tr("User name:"), QLineEdit.Normal,
QDir().home().dirName(), ok)
- if ok and not text.isEmpty():
+ if ok and text:
textLabel.setText(text)
//! [3]
diff --git a/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp b/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp
index bcae8c8..cc59b36 100644
--- a/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp
+++ b/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp
@@ -113,7 +113,7 @@ def createConclusionPage(self):
def main():
app = QApplication(sys.argv)
- translatorFileName = QLatin1String("qt_")
+ translatorFileName = "qt_"
translatorFileName += QLocale.system().name()
translator = QTranslator(app)
if translator.load(translatorFileName, QLibraryInfo.location(QLibraryInfo.TranslationsPath)):
diff --git a/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp b/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp
index b1d14de..743df78 100644
--- a/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp
+++ b/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp
@@ -68,9 +68,9 @@ def setData(self, index, value, role):
ok = False
if index.column() == 1:
- ok = self.setFirstName(id, value.toString())
+ ok = self.setFirstName(id, value)
else:
- ok = self.setLastName(id, value.toString())
+ ok = self.setLastName(id, value)
self.refresh()
return ok
}
diff --git a/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp b/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp
index 93c5209..b59646d 100644
--- a/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp
+++ b/doc/codesnippets/examples/sql/relationaltablemodel/relationaltablemodel.cpp
@@ -100,11 +100,11 @@ def main():
createRelationalTables()
- QSqlRelationalTableModel model
+ model = QSqlRelationalTableModel()
- initializeModel(&model)
+ initializeModel(model)
- view = createView(QObject.tr("Relational Table Model"), &model)
+ view = createView(QObject.tr("Relational Table Model"), model)
view.show()
return app.exec_()
diff --git a/doc/codesnippets/snippets/textdocument-resources/main.cpp b/doc/codesnippets/snippets/textdocument-resources/main.cpp
index e8f010a..86da5e2 100644
--- a/doc/codesnippets/snippets/textdocument-resources/main.cpp
+++ b/doc/codesnippets/snippets/textdocument-resources/main.cpp
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
//! [Adding a resource]
document.addResource(QTextDocument.ImageResource,
- QUrl("mydata://image.png"), QVariant(image))
+ QUrl("mydata://image.png"), image)
//! [Adding a resource]
//! [Inserting an image with a cursor]