3
0

QConnectionListWidget.h 985 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <QListWidget>
  10. #include <QPainter>
  11. #include <QRect>
  12. //-----------------------------------------------------------------------------------------------//
  13. class QConnectionListWidget
  14. : public QListWidget
  15. {
  16. public:
  17. QConnectionListWidget(QWidget* pParent)
  18. : QListWidget(pParent)
  19. {}
  20. private:
  21. void paintEvent(QPaintEvent* pEvent) override
  22. {
  23. QListView::paintEvent(pEvent);
  24. if (count() == 0)
  25. {
  26. QPainter painter(viewport());
  27. QRect area = rect();
  28. painter.drawText(area, Qt::AlignCenter, "Drag and drop a control to connect to it");
  29. area.setY(area.y() - 25);
  30. painter.drawText(area, Qt::AlignCenter, "No connections");
  31. }
  32. }
  33. };