test3.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (c) 2006-2007, Johan Thelin
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * * Redistributions of source code must retain the above copyright notice,
  10. * this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. * * Neither the name of APress nor the names of its contributors
  15. * may be used to endorse or promote products derived from this software
  16. * without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  23. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  24. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  25. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  26. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  27. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. */
  31. #include <QApplication>
  32. #include <QFontDialog>
  33. #include <QColorDialog>
  34. class Tester : public QWidget
  35. {public:
  36. void doColor()
  37. /* haha */
  38. {
  39. QColor color = QColorDialog::getColor(Qt::yellow, this );
  40. if( color.isValid() )
  41. {
  42. qDebug( "ok" );
  43. }
  44. }
  45. #define asdsads
  46. #define asdsads
  47. #define asdsads
  48. void doFont()
  49. #define asd
  50. {
  51. bool ok;
  52. QFont font = QFontDialog::getFont(
  53. &ok,
  54. QFont( "Arial", 18 ),
  55. this,
  56. tr("Pick a font") );
  57. if( ok )
  58. {
  59. qDebug( "ok" );
  60. }
  61. }
  62. }} // non-matching brackets for test!!
  63. #define asdsads
  64. #define asdsads
  65. #define asdsads
  66. void doFont222()
  67. #define asd
  68. {
  69. bool ok;
  70. QFont font = QFontDialog::getFont(
  71. &ok,
  72. QFont( "Arial", 18 ),
  73. this,
  74. tr("Pick a font") );
  75. if(){}
  76. if( ok )
  77. {
  78. qDebug( "ok" );
  79. }
  80. }
  81. };
  82. namespace not_closed { // non matching open bracket for test
  83. int main( int argc, char **argv )
  84. {
  85. QApplication app( argc, argv );
  86. Tester t;
  87. t.doColor();
  88. t.doFont();
  89. return 0;
  90. }
  91. namespace {
  92. typedef struct{
  93. } aa;
  94. }