HAL  v4.5.0-131-gda71a6012
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal_qt_compat.cpp
Go to the documentation of this file.
2 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
3 #include <QGuiApplication>
4 #include <QScreen>
5 #else
6 #include <QDesktopWidget>
7 #endif
8 namespace hal {
9 
11  {
12 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
13  return QGuiApplication::primaryScreen()->availableGeometry();
14 #else
15  return qApp->desktop()->availableGeometry();
16 #endif
17  }
18 
20  {
21 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
22  return QGuiApplication::primaryScreen()->geometry();
23 #else
24  return qApp->desktop()->screenGeometry();
25 #endif
26  }
27 
29  {
30 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
31  return widget->screen()->availableGeometry();
32 #else
33  return qApp->desktop()->availableGeometry(widget);
34 #endif
35  }
36 
38  {
39 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
40  return qHash(p,0);
41 #else
42  return qHash(p);
43 #endif
44  }
45 /*
46  template<typename T>
47  QSet<T> QtCompat::listToSet(const QList<T>& list)
48  {
49 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
50  return QSet<T>(list.constBegin(),list.constEnd());
51 #else
52  return QSet<T>::fromList(list);
53 #endif
54  }
55 
56  template<typename T>
57  QList<T> setToList(const QSet<T>& cset)
58  {
59 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
60  return QList<T>(cset.constBegin(),cset.constEnd());
61 #else
62  return QList<T>::fromset(list);
63 #endif
64  }
65 
66  template<typename T>
67  QVector<T> QtCompat::listToVector(const QList<T>& list)
68 
69  {
70 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
71  return QVector<T>(list.constBegin(),list.constEnd());
72 #else
73  return QVector<T>::fromList(list);
74 #endif
75  }
76 
77 
78  template<typename T> extern QVector<T> QtCompat::stdVectorToVector(const std::vector<T>& vec)
79  {
80 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
81  return QVector<T>(vec.begin(),vec.end());
82 #else
83  return QVector<T>::fromStdVector(vec);
84 #endif
85  }
86  */
87 
88  void QtCompat::setMarginWidth(QLayout* layout, int marginWidth)
89  {
90 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
91  layout->setContentsMargins(marginWidth, marginWidth, marginWidth, marginWidth);
92 #else
93  layout->setMargin(marginWith);
94 #endif
95  }
96 
98  {
99 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
100  opt.initFrom(widget);
101 #else
102  opt.init(widget);
103 #endif
104  }
105 
107  {
108 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
110 #else
112 #endif
113  }
114 
115 }
QString dateToLocaleString(const QDateTime &dt)
QRect desktopAvailableGeometry()
QRect widgetAvailableGeometry(QWidget *widget)
uint qHashPoint(const QPoint &p)
QRect desktopScreenGeometry()
void setMarginWidth(QLayout *layout, int marginWidth)
void styleOptionInit(QStyleOption &opt, QWidget *widget)
Definition: defines.h:45
uint qHash(const LaneIndex &ri)
QString toString(Qt::DateFormat format) const const
void setMargin(int margin)
void setContentsMargins(int left, int top, int right, int bottom)
QLocale system()
QString toString(qlonglong i) const const
void init(const QWidget *widget)
void initFrom(const QWidget *widget)
SystemLocaleShortDate
QScreen * screen() const const