diff options
author | Darafei Praliaskouski <komzpa@mapswith.me> | 2013-07-04 16:28:33 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:58:07 +0300 |
commit | a3353dbd542388b14fcb7b37f50d0b9d0ddedffd (patch) | |
tree | 52336db0a76564e4270167d901a9028b9a4fe469 /qt/search_panel.cpp | |
parent | 2586ee90ef57e36a66b2722a6f5412455b811a66 (diff) |
[qt] allow qt4 builds
Diffstat (limited to 'qt/search_panel.cpp')
-rw-r--r-- | qt/search_panel.cpp | 61 |
1 files changed, 20 insertions, 41 deletions
diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp index 6e7b2e4514..d057de3b6f 100644 --- a/qt/search_panel.cpp +++ b/qt/search_panel.cpp @@ -9,13 +9,21 @@ #include <QtGui/QBitmap> -#include <QtWidgets/QHeaderView> -#include <QtWidgets/QTableWidget> -#include <QtWidgets/QLineEdit> -#include <QtWidgets/QVBoxLayout> -#include <QtWidgets/QHBoxLayout> -#include <QtWidgets/QPushButton> - +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + #include <QtGui/QHeaderView> + #include <QtGui/QTableWidget> + #include <QtGui/QLineEdit> + #include <QtGui/QVBoxLayout> + #include <QtGui/QHBoxLayout> + #include <QtGui/QPushButton> +#else + #include <QtWidgets/QHeaderView> + #include <QtWidgets/QTableWidget> + #include <QtWidgets/QLineEdit> + #include <QtWidgets/QVBoxLayout> + #include <QtWidgets/QHBoxLayout> + #include <QtWidgets/QPushButton> +#endif namespace qt { @@ -34,7 +42,12 @@ SearchPanel::SearchPanel(DrawWidget * drawWidget, QWidget * parent) m_pTable->setSelectionBehavior(QAbstractItemView::SelectRows); m_pTable->verticalHeader()->setVisible(false); m_pTable->horizontalHeader()->setVisible(false); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + m_pTable->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); +#else m_pTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); +#endif + connect(m_pTable, SIGNAL(cellClicked(int, int)), this, SLOT(OnSearchPanelItemClicked(int,int))); m_pClearButton = new QPushButton(this); @@ -72,40 +85,6 @@ namespace item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); return item; } - - /* - QIcon draw_direction(double a) - { - int const dim = 64; - - QPixmap pm(dim, dim); - - QBitmap mask(dim, dim); - mask.clear(); - pm.setMask(mask); - - QPainter painter(&pm); - painter.setBackgroundMode(Qt::TransparentMode); - - QMatrix m; - m.translate(dim/2, dim/2); - m.rotate(-a / math::pi * 180.0); - m.translate(-dim/2, -dim/2); - - typedef QPointF P; - QPolygonF poly(5); - poly[0] = P(dim/3, dim/2); - poly[1] = P(0, dim/2 - dim/3); - poly[2] = P(dim, dim/2); - poly[3] = P(0, dim/2 + dim/3); - poly[4] = P(dim/3, dim/2); - - painter.setBrush(Qt::black); - painter.drawPolygon(m.map(poly)); - - return pm; - } - */ } void SearchPanel::OnSearchResult(ResultsT * res) |