ctkHostedAppPlaceholderWidget.h 810 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef CTKHOSTEDAPPPLACEHOLDERWIDGET_H
  2. #define CTKHOSTEDAPPPLACEHOLDERWIDGET_H
  3. #include <QFrame>
  4. #include <QDebug>
  5. #include <org_commontk_dicom_examplehost_Export.h>
  6. class org_commontk_dicom_examplehost_EXPORT ctkHostedAppPlaceholderWidget : public QFrame
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit ctkHostedAppPlaceholderWidget(QWidget *parent = 0);
  11. QRect getAbsolutePosition()
  12. {
  13. QWidget* current = this;
  14. int x = 0;
  15. int y = 0;
  16. do
  17. {
  18. x = x + current->x();
  19. y = y + current->y();
  20. current = dynamic_cast<QWidget*>(current->parent());
  21. } while (current);
  22. return QRect(x,y,width(),height());
  23. }
  24. signals:
  25. void resized();
  26. protected:
  27. void resizeEvent(QResizeEvent* /* event */) { emit resized(); }
  28. };
  29. #endif // CTKHOSTEDAPPPLACEHOLDERWIDGET_H