/vp_plugins/tEditor/undoframe.cpp

http://cupsfilter.googlecode.com/ · C++ · 88 lines · 68 code · 19 blank · 1 comment · 1 complexity · 7feeb1440686c9cdebd3a61f048dc6a4 MD5 · raw file

  1. #include "undoframe.h"
  2. #include <QtGui/QDockWidget>
  3. #include <QtGui/QHBoxLayout>
  4. #include <QtGui/QLabel>
  5. #include <QtGui/QSpacerItem>
  6. #include <QtGui/QSpinBox>
  7. #include <QtGui/QUndoView>
  8. #include <QtGui/QVBoxLayout>
  9. #include <QtGui/QWidget>
  10. #include <QtGui/QUndoGroup>
  11. UndoFrame::UndoFrame(QWidget *parent) :
  12. QDockWidget(parent)
  13. {
  14. //resize(100, 420);
  15. dockWidgetContents = new QWidget();
  16. dockWidgetContents->setObjectName(QString::fromUtf8("dockWidgetContents"));
  17. vboxLayout = new QVBoxLayout(dockWidgetContents);
  18. vboxLayout->setSpacing(4);
  19. vboxLayout->setMargin(0);
  20. vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
  21. hboxLayout = new QHBoxLayout();
  22. #ifndef Q_OS_MAC
  23. hboxLayout->setSpacing(6);
  24. #endif
  25. #ifndef Q_OS_MAC
  26. hboxLayout->setMargin(0);
  27. #endif
  28. hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
  29. spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
  30. hboxLayout->addItem(spacerItem);
  31. label = new QLabel(dockWidgetContents);
  32. label->setObjectName(QString::fromUtf8("label"));
  33. hboxLayout->addWidget(label);
  34. undoLimit = new QSpinBox(dockWidgetContents);
  35. undoLimit->setObjectName(QString::fromUtf8("undoLimit"));
  36. hboxLayout->addWidget(undoLimit);
  37. vboxLayout->addLayout(hboxLayout);
  38. undoView = new QUndoView(dockWidgetContents);
  39. undoView->setObjectName(QString::fromUtf8("undoView"));
  40. undoView->setAlternatingRowColors(false);
  41. vboxLayout->addWidget(undoView);
  42. setWidget(dockWidgetContents);
  43. retranslateUi();
  44. connect (undoLimit, SIGNAL(valueChanged(int)),
  45. this, SIGNAL(undoLimitChange(int))
  46. );
  47. }
  48. void UndoFrame::setUndoViewGroup(QUndoGroup * undoGroup)
  49. {
  50. undoView->setGroup(undoGroup);
  51. undoView->setEmptyLabel(QObject::trUtf8("??? ?????????"));
  52. undoView->setCleanIcon(QIcon(":/ok.png"));
  53. }
  54. void UndoFrame::retranslateUi()
  55. {
  56. this->setWindowTitle(QObject::trUtf8("???????..."));
  57. label->setText(QObject::trUtf8("????? ?????"));
  58. } // retranslateUi
  59. void UndoFrame::changeEvent(QEvent *e)
  60. {
  61. QDockWidget::changeEvent(e);
  62. switch (e->type()) {
  63. case QEvent::LanguageChange:
  64. this->retranslateUi();
  65. break;
  66. default:
  67. break;
  68. }
  69. }