Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 17th, 2011  |  syntax: C++ (with QT extensions)  |  size: 0.94 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <QtCore/QCoreApplication>
  2. #include <QtGui/QApplication>
  3. #include <QMainWindow>
  4. #include <QPushButton>
  5. #include <QLabel>
  6. #include <QVBoxLayout>
  7.  
  8. int main(int argc, char *argv[])
  9. {
  10.     QApplication a(argc, argv);
  11.     QMainWindow w;
  12.     w.show();
  13.  
  14.     QWidget widget(&w);
  15.  
  16.     QPushButton button("About Qt", &widget);
  17.     QObject::connect(&button, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
  18.  
  19.     QString text;
  20.     text.append("Test case to reproduce QTBUG-18720\n");
  21.     text.append("1) Tap About Qt button\n");
  22.     text.append("2) Attempt to select the text that shows");
  23.     text.append("\n\nExpected result: Text gets highlighted correctly\n");
  24.     text.append("Actual result: text that is highlighted turns invisible");
  25.     QLabel label(text, &widget);
  26.  
  27.     QVBoxLayout layout(&widget);
  28.     layout.addWidget(&label);
  29.     layout.addWidget(&button);
  30.     w.setCentralWidget(&widget);
  31.  
  32.     w.show();
  33.  
  34.     return a.exec();
  35. }