Permalink
Browse files

Format all code using clang-format

  • Loading branch information...
1 parent e4e0b73 commit 00a053feb386c6de52ad8459b2f5cac8362d456a @steveire committed Mar 17, 2016
Showing with 14,624 additions and 12,658 deletions.
  1. +60 −50 examples/books/bookdelegate.cpp
  2. +11 −10 examples/books/bookdelegate.h
  3. +147 −137 examples/books/bookwindow.cpp
  4. +9 −9 examples/books/bookwindow.h
  5. +0 −1 examples/books/bookwrapper.cpp
  6. +6 −3 examples/books/bookwrapper.h
  7. +66 −56 examples/books/initdb.h
  8. +6 −6 examples/books/main.cpp
  9. +8 −9 examples/codegen/codegentableview.cpp
  10. +2 −3 examples/codegen/codegentableview.h
  11. +20 −26 examples/codegen/comboboxdelegate.cpp
  12. +14 −29 examples/codegen/comboboxdelegate.h
  13. +3 −2 examples/codegen/comboboxdelegate_p.h
  14. +50 −46 examples/codegen/designwidget.cpp
  15. +6 −3 examples/codegen/designwidget.h
  16. +6 −6 examples/codegen/main.cpp
  17. +45 −48 examples/codegen/mainwindow.cpp
  18. +1 −1 examples/codegen/mainwindow.h
  19. +17 −16 examples/codegen/methodmodel.cpp
  20. +5 −6 examples/codegen/methodmodel.h
  21. +11 −17 examples/codegen/propertytablewidget.cpp
  22. +2 −3 examples/codegen/propertytablewidget.h
  23. +28 −105 examples/contacts/contact.cpp
  24. +15 −15 examples/contacts/contact.h
  25. +43 −33 examples/contacts/kdelocalizer.cpp
  26. +25 −10 examples/contacts/kdelocalizer.h
  27. +6 −6 examples/contacts/main_kde.cpp
  28. +17 −13 examples/contacts/main_linguist.cpp
  29. +42 −37 examples/contacts/mainwindow.cpp
  30. +11 −10 examples/contacts/mainwindow.h
  31. +1 −2 examples/htmlapps/customplugin.cpp
  32. +13 −14 examples/htmlapps/customplugin.h
  33. +8 −5 examples/htmlapps/localrequestmanager.cpp
  34. +4 −1 examples/htmlapps/localrequestmanager.h
  35. +6 −6 examples/htmlapps/mainwindow.cpp
  36. +0 −1 examples/htmlapps/mainwindow.h
  37. +70 −60 examples/htmlapps/rssfeed.cpp
  38. +22 −15 examples/htmlapps/rssfeed.h
  39. +17 −38 examples/htmlapps/templatereply.cpp
  40. +5 −3 examples/htmlapps/templatereply.h
  41. +22 −27 examples/textedit/audioobject.cpp
  42. +9 −11 examples/textedit/audioobject.h
  43. +17 −22 examples/textedit/audiotextdocumentoutputter.cpp
  44. +11 −9 examples/textedit/audiotextdocumentoutputter.h
  45. +12 −14 examples/textedit/audiotextedit.cpp
  46. +2 −3 examples/textedit/audiotextedit.h
  47. +0 −1 examples/textedit/customtagslibrary.cpp
  48. +9 −11 examples/textedit/customtagslibrary.h
  49. +10 −4 examples/textedit/filters.cpp
  50. +8 −10 examples/textedit/filters.h
  51. +8 −8 examples/textedit/main.cpp
  52. +614 −564 examples/textedit/textedit.cpp
  53. +55 −65 examples/textedit/textedit.h
  54. +65 −58 templates/defaultfilters/datetime.cpp
  55. +12 −4 templates/defaultfilters/datetime.h
  56. +56 −56 templates/defaultfilters/defaultfilters.h
  57. +33 −29 templates/defaultfilters/integers.cpp
  58. +7 −5 templates/defaultfilters/integers.h
  59. +138 −115 templates/defaultfilters/lists.cpp
  60. +41 −37 templates/defaultfilters/lists.h
  61. +38 −30 templates/defaultfilters/logic.cpp
  62. +12 −4 templates/defaultfilters/logic.h
  63. +1 −1 templates/defaultfilters/misc.h
  64. +273 −201 templates/defaultfilters/stringfilters.cpp
  65. +102 −95 templates/defaultfilters/stringfilters.h
  66. +21 −26 templates/defaulttags/autoescape.cpp
  67. +5 −10 templates/defaulttags/autoescape.h
  68. +9 −17 templates/defaulttags/comment.cpp
  69. +3 −5 templates/defaulttags/comment.h
  70. +50 −45 templates/defaulttags/cycle.cpp
  71. +15 −17 templates/defaulttags/cycle.h
  72. +17 −26 templates/defaulttags/debug.cpp
  73. +3 −5 templates/defaulttags/debug.h
  74. +37 −30 templates/defaulttags/defaulttags.h
  75. +23 −24 templates/defaulttags/filtertag.cpp
  76. +4 −5 templates/defaulttags/filtertag.h
  77. +15 −17 templates/defaulttags/firstof.cpp
  78. +4 −4 templates/defaulttags/firstof.h
  79. +116 −113 templates/defaulttags/for.cpp
  80. +13 −18 templates/defaulttags/for.h
  81. +66 −65 templates/defaulttags/if.cpp
  82. +10 −13 templates/defaulttags/if.h
  83. +43 −41 templates/defaulttags/ifchanged.cpp
  84. +6 −7 templates/defaulttags/ifchanged.h
  85. +36 −39 templates/defaulttags/ifequal.cpp
  86. +8 −8 templates/defaulttags/ifequal.h
  87. +16 −21 templates/defaulttags/load.cpp
  88. +3 −4 templates/defaulttags/load.h
  89. +26 −25 templates/defaulttags/mediafinder.cpp
  90. +5 −6 templates/defaulttags/mediafinder.h
  91. +13 −16 templates/defaulttags/now.cpp
  92. +3 −5 templates/defaulttags/now.h
  93. +48 −47 templates/defaulttags/range.cpp
  94. +10 −10 templates/defaulttags/range.h
  95. +56 −44 templates/defaulttags/regroup.cpp
  96. +5 −7 templates/defaulttags/regroup.h
  97. +16 −27 templates/defaulttags/spaceless.cpp
  98. +5 −8 templates/defaulttags/spaceless.h
  99. +28 −28 templates/defaulttags/templatetag.cpp
  100. +4 −5 templates/defaulttags/templatetag.h
  101. +27 −31 templates/defaulttags/widthratio.cpp
  102. +6 −7 templates/defaulttags/widthratio.h
  103. +19 −24 templates/defaulttags/with.cpp
  104. +5 −6 templates/defaulttags/with.h
  105. +64 −54 templates/i18n/i18n.cpp
  106. +8 −8 templates/i18n/i18n.h
  107. +97 −74 templates/i18n/i18nc.cpp
  108. +9 −8 templates/i18n/i18nc.h
  109. +111 −79 templates/i18n/i18ncp.cpp
  110. +11 −8 templates/i18n/i18ncp.h
  111. +85 −68 templates/i18n/i18np.cpp
  112. +9 −8 templates/i18n/i18np.h
  113. +25 −19 templates/i18n/i18ntags.h
  114. +44 −42 templates/i18n/l10n_money.cpp
  115. +9 −8 templates/i18n/l10n_money.h
  116. +22 −21 templates/i18n/with_locale.cpp
  117. +4 −6 templates/i18n/with_locale.h
  118. +16 −21 templates/lib/abstractlocalizer.cpp
  119. +46 −21 templates/lib/abstractlocalizer.h
  120. +27 −28 templates/lib/cachingloaderdecorator.cpp
  121. +21 −15 templates/lib/cachingloaderdecorator.h
  122. +68 −79 templates/lib/context.cpp
  123. +53 −40 templates/lib/context.h
  124. +16 −12 templates/lib/customtyperegistry.cpp
  125. +11 −18 templates/lib/customtyperegistry_p.h
  126. +165 −151 templates/lib/engine.cpp
  127. +62 −38 templates/lib/engine.h
  128. +30 −25 templates/lib/engine_p.h
  129. +15 −16 templates/lib/exception.h
  130. +8 −15 templates/lib/filter.cpp
  131. +26 −18 templates/lib/filter.h
  132. +116 −114 templates/lib/filterexpression.cpp
  133. +39 −22 templates/lib/filterexpression.h
  134. +2 −3 templates/lib/grantlee_tags_p.h
  135. +1 −1 templates/lib/grantlee_templates.h
  136. +198 −153 templates/lib/lexer.cpp
  137. +52 −75 templates/lib/lexer_p.h
  138. +12 −19 templates/lib/metaenumvariable_p.h
  139. +53 −54 templates/lib/metatype.cpp
  140. +54 −55 templates/lib/metatype.h
  141. +80 −99 templates/lib/node.cpp
  142. +86 −54 templates/lib/node.h
  143. +8 −8 templates/lib/nodebuiltins.cpp
  144. +9 −8 templates/lib/nodebuiltins_p.h
  145. +74 −73 templates/lib/nulllocalizer.cpp
  146. +32 −15 templates/lib/nulllocalizer_p.h
  147. +26 −38 templates/lib/outputstream.cpp
  148. +31 −20 templates/lib/outputstream.h
  149. +146 −118 templates/lib/parser.cpp
  150. +32 −22 templates/lib/parser.h
  151. +18 −31 templates/lib/pluginpointer_p.h
  152. +161 −148 templates/lib/qtlocalizer.cpp
  153. +44 −24 templates/lib/qtlocalizer.h
  154. +17 −29 templates/lib/rendercontext.cpp
  155. +9 −8 templates/lib/rendercontext.h
  156. +249 −200 templates/lib/safestring.cpp
  157. +174 −124 templates/lib/safestring.h
  158. +80 −65 templates/lib/statemachine_p.h
  159. +15 −10 templates/lib/taglibraryinterface.h
  160. +36 −38 templates/lib/template.cpp
  161. +22 −16 templates/lib/template.h
  162. +6 −9 templates/lib/template_p.h
  163. +82 −75 templates/lib/templateloader.cpp
  164. +50 −33 templates/lib/templateloader.h
  165. +8 −7 templates/lib/textprocessingmachine.cpp
  166. +20 −32 templates/lib/textprocessingmachine_p.h
  167. +8 −9 templates/lib/token.h
  168. +6 −12 templates/lib/typeaccessor.h
  169. +68 −60 templates/lib/typeaccessors.cpp
  170. +73 −75 templates/lib/util.cpp
  171. +21 −14 templates/lib/util.h
  172. +64 −72 templates/lib/variable.cpp
  173. +19 −14 templates/lib/variable.h
  174. +64 −64 templates/loadertags/block.cpp
  175. +10 −12 templates/loadertags/block.h
  176. +12 −15 templates/loadertags/blockcontext.cpp
  177. +6 −7 templates/loadertags/blockcontext.h
  178. +64 −60 templates/loadertags/extends.cpp
  179. +9 −13 templates/loadertags/extends.h
  180. +39 −36 templates/loadertags/include.cpp
  181. +5 −8 templates/loadertags/include.h
  182. +10 −10 templates/loadertags/loadertags.h
  183. +16 −25 templates/scriptabletags/scriptablecontext.cpp
  184. +5 −9 templates/scriptabletags/scriptablecontext.h
  185. +41 −39 templates/scriptabletags/scriptablefilter.cpp
  186. +3 −3 templates/scriptabletags/scriptablefilter.h
  187. +28 −28 templates/scriptabletags/scriptablefilterexpression.cpp
  188. +9 −9 templates/scriptabletags/scriptablefilterexpression.h
  189. +60 −59 templates/scriptabletags/scriptablenode.cpp
  190. +17 −21 templates/scriptabletags/scriptablenode.h
  191. +15 −31 templates/scriptabletags/scriptableparser.cpp
  192. +6 −9 templates/scriptabletags/scriptableparser.h
  193. +19 −33 templates/scriptabletags/scriptablesafestring.cpp
  194. +4 −6 templates/scriptabletags/scriptablesafestring.h
  195. +101 −76 templates/scriptabletags/scriptabletags.cpp
  196. +13 −14 templates/scriptabletags/scriptabletags.h
  197. +23 −24 templates/scriptabletags/scriptabletemplate.cpp
  198. +5 −6 templates/scriptabletags/scriptabletemplate.h
  199. +23 −25 templates/scriptabletags/scriptablevariable.cpp
  200. +7 −7 templates/scriptabletags/scriptablevariable.h
  201. +81 −86 templates/tests/benchmarks.cpp
  202. +12 −16 templates/tests/coverageobject.cpp
  203. +11 −10 templates/tests/coverageobject.h
  204. +49 −85 templates/tests/operatorcasttests.cpp
  205. +16 −12 templates/tests/pluginpointertest/main.cpp
  206. +4 −2 templates/tests/pluginpointertest/myinterface.h
  207. +5 −11 templates/tests/pluginpointertest/myobject.cpp
  208. +4 −3 templates/tests/pluginpointertest/myobject.h
  209. +5 −8 templates/tests/qtunorderedmap.h
  210. +54 −32 templates/tests/templatedirs/main.cpp
  211. +21 −9 templates/tests/test_input.cpp
  212. +17 −18 templates/tests/test_macros.h
  213. +1,289 −990 templates/tests/testbuiltins.cpp
  214. +12 −12 templates/tests/testcachingloader.cpp
  215. +1,525 −963 templates/tests/testdefaulttags.cpp
  216. +1,045 −574 templates/tests/testfilters.cpp
  217. +141 −180 templates/tests/testgenericcontainers.cpp
  218. +288 −339 templates/tests/testgenerictypes.cpp
  219. +526 −495 templates/tests/testinternationalization.cpp
  220. +302 −184 templates/tests/testloadertags.cpp
  221. +50 −50 templates/tests/testsafestring.cpp
  222. +98 −76 templates/tests/testscriptabletags.cpp
  223. +42 −24 textdocument/lib/abstractmarkupbuilder.h
  224. +61 −107 textdocument/lib/bbcodebuilder.cpp
  225. +15 −16 textdocument/lib/bbcodebuilder.h
  226. +1 −1 textdocument/lib/grantlee_textdocument.h
  227. +376 −330 textdocument/lib/markupdirector.cpp
  228. +119 −63 textdocument/lib/markupdirector.h
  229. +8 −11 textdocument/lib/markupdirector_p.h
  230. +49 −62 textdocument/lib/mediawikimarkupbuilder.cpp
  231. +7 −8 textdocument/lib/mediawikimarkupbuilder.h
  232. +183 −206 textdocument/lib/plaintextmarkupbuilder.cpp
  233. +44 −31 textdocument/lib/plaintextmarkupbuilder.h
  234. +190 −176 textdocument/lib/texthtmlbuilder.cpp
  235. +51 −35 textdocument/lib/texthtmlbuilder.h
  236. +9 −10 textdocument/tests/coverageobject.cpp
  237. +7 −7 textdocument/tests/coverageobject.h
  238. +345 −320 textdocument/tests/htmlbuildertest.cpp
  239. +403 −390 textdocument/tests/plainmarkupbuildertest.cpp
@@ -41,8 +41,8 @@
#include "bookdelegate.h"
-#include <QPainter>
#include <QMouseEvent>
+#include <QPainter>
#include <QSpinBox>
BookDelegate::BookDelegate(QObject *parent)
@@ -51,77 +51,87 @@ BookDelegate::BookDelegate(QObject *parent)
}
void BookDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+ const QModelIndex &index) const
{
- if (index.column() != 5) {
- QStyleOptionViewItemV3 opt = option;
- opt.rect.adjust(0, 0, -1, -1); // since we draw the grid ourselves
- QSqlRelationalDelegate::paint(painter, opt, index);
- } else {
- const QAbstractItemModel *model = index.model();
- QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ?
- (option.state & QStyle::State_Active) ? QPalette::Normal : QPalette::Inactive : QPalette::Disabled;
+ if (index.column() != 5) {
+ QStyleOptionViewItemV3 opt = option;
+ opt.rect.adjust(0, 0, -1, -1); // since we draw the grid ourselves
+ QSqlRelationalDelegate::paint(painter, opt, index);
+ } else {
+ const QAbstractItemModel *model = index.model();
+ QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled)
+ ? (option.state & QStyle::State_Active)
+ ? QPalette::Normal
+ : QPalette::Inactive
+ : QPalette::Disabled;
- if (option.state & QStyle::State_Selected)
- painter->fillRect(option.rect, option.palette.color(cg, QPalette::Highlight));
+ if (option.state & QStyle::State_Selected)
+ painter->fillRect(option.rect,
+ option.palette.color(cg, QPalette::Highlight));
- int rating = model->data(index, Qt::DisplayRole).toInt();
- int width = star.width();
- int height = star.height();
- int x = option.rect.x();
- int y = option.rect.y() + (option.rect.height() / 2) - (height / 2);
- for (int i = 0; i < rating; ++i) {
- painter->drawPixmap(x, y, star);
- x += width;
- }
- drawFocus(painter, option, option.rect.adjusted(0, 0, -1, -1)); // since we draw the grid ourselves
+ int rating = model->data(index, Qt::DisplayRole).toInt();
+ int width = star.width();
+ int height = star.height();
+ int x = option.rect.x();
+ int y = option.rect.y() + (option.rect.height() / 2) - (height / 2);
+ for (int i = 0; i < rating; ++i) {
+ painter->drawPixmap(x, y, star);
+ x += width;
}
+ drawFocus(
+ painter, option,
+ option.rect.adjusted(0, 0, -1, -1)); // since we draw the grid ourselves
+ }
- QPen pen = painter->pen();
- painter->setPen(option.palette.color(QPalette::Mid));
- painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
- painter->drawLine(option.rect.topRight(), option.rect.bottomRight());
- painter->setPen(pen);
+ QPen pen = painter->pen();
+ painter->setPen(option.palette.color(QPalette::Mid));
+ painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
+ painter->drawLine(option.rect.topRight(), option.rect.bottomRight());
+ painter->setPen(pen);
}
QSize BookDelegate::sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const
+ const QModelIndex &index) const
{
- if (index.column() == 5)
- return QSize(5 * star.width(), star.height()) + QSize(1, 1);
+ if (index.column() == 5)
+ return QSize(5 * star.width(), star.height()) + QSize(1, 1);
- return QSqlRelationalDelegate::sizeHint(option, index) + QSize(1, 1); // since we draw the grid ourselves
+ return QSqlRelationalDelegate::sizeHint(option, index)
+ + QSize(1, 1); // since we draw the grid ourselves
}
bool BookDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index)
{
- if (index.column() != 5)
- return QSqlRelationalDelegate::editorEvent(event, model, option, index);
+ if (index.column() != 5)
+ return QSqlRelationalDelegate::editorEvent(event, model, option, index);
- if (event->type() == QEvent::MouseButtonPress) {
- QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
- int stars = qBound(0, int(0.7 + qreal(mouseEvent->pos().x()
- - option.rect.x()) / star.width()), 5);
- model->setData(index, QVariant(stars));
- return false; //so that the selection can change
- }
+ if (event->type() == QEvent::MouseButtonPress) {
+ QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+ int stars = qBound(
+ 0, int(0.7
+ + qreal(mouseEvent->pos().x() - option.rect.x()) / star.width()),
+ 5);
+ model->setData(index, QVariant(stars));
+ return false; // so that the selection can change
+ }
- return true;
+ return true;
}
-QWidget *BookDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+QWidget *BookDelegate::createEditor(QWidget *parent,
+ const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
- if (index.column() != 4)
- return QSqlRelationalDelegate::createEditor(parent, option, index);
+ if (index.column() != 4)
+ return QSqlRelationalDelegate::createEditor(parent, option, index);
- // for editing the year, return a spinbox with a range from -1000 to 2100.
- QSpinBox *sb = new QSpinBox(parent);
- sb->setFrame(false);
- sb->setMaximum(2100);
- sb->setMinimum(-1000);
+ // for editing the year, return a spinbox with a range from -1000 to 2100.
+ QSpinBox *sb = new QSpinBox(parent);
+ sb->setFrame(false);
+ sb->setMaximum(2100);
+ sb->setMinimum(-1000);
- return sb;
+ return sb;
}
@@ -52,22 +52,23 @@ QT_FORWARD_DECLARE_CLASS(QPainter)
class BookDelegate : public QSqlRelationalDelegate
{
public:
- BookDelegate(QObject *parent);
+ BookDelegate(QObject *parent);
- void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ void paint(QPainter *painter, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ QSize sizeHint(const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
- bool editorEvent(QEvent *event, QAbstractItemModel *model,
- const QStyleOptionViewItem &option,
- const QModelIndex &index);
+ bool editorEvent(QEvent *event, QAbstractItemModel *model,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index);
- QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
private:
- QPixmap star;
+ QPixmap star;
};
#endif
Oops, something went wrong.

0 comments on commit 00a053f

Please sign in to comment.