mirror of
https://github.com/leozide/leocad
synced 2025-01-13 08:01:38 +01:00
Added support for Qt5.
This commit is contained in:
parent
f4e905e4f4
commit
ec04ed1f6f
5 changed files with 28 additions and 2 deletions
|
@ -3,7 +3,7 @@ TEMPLATE = app
|
|||
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
# DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
||||
# QT *= printsupport
|
||||
QT *= printsupport
|
||||
}
|
||||
|
||||
INCLUDEPATH += qt common
|
||||
|
|
|
@ -96,7 +96,12 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
|||
table->setColumnCount(numColors + 1);
|
||||
table->setRowCount(numInfos);
|
||||
table->setHorizontalHeaderLabels(horizontalLabels);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
table->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
table->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
for (int rowIdx = 0; rowIdx < partNames.size(); rowIdx++)
|
||||
table->setItem(rowIdx, 0, new QTableWidgetItem(partNames[rowIdx]));
|
||||
|
|
|
@ -253,8 +253,13 @@ lcQPropertiesTree::lcQPropertiesTree(QWidget *parent) :
|
|||
labels.append(tr("Property"));
|
||||
labels.append(tr("Value"));
|
||||
setHeaderLabels(labels);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
header()->setSectionsMovable(false);
|
||||
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
#else
|
||||
header()->setMovable(false);
|
||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
header()->setVisible(false);
|
||||
setAlternatingRowColors(true);
|
||||
setRootIsDecorated(false);
|
||||
|
|
|
@ -21,18 +21,30 @@ bool lcQTreeWidgetColumnStretcher::eventFilter(QObject *obj, QEvent *ev)
|
|||
{
|
||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
||||
for (int i = 0; i < hv->count(); ++i)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
hv->setSectionResizeMode(i, QHeaderView::Interactive);
|
||||
#else
|
||||
hv->setResizeMode(i, QHeaderView::Interactive);
|
||||
#endif
|
||||
}
|
||||
else if (ev->type() == QEvent::Hide)
|
||||
{
|
||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
||||
for (int i = 0; i < hv->count(); ++i)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
hv->setSectionResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
|
||||
#else
|
||||
hv->setResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
}
|
||||
else if (ev->type() == QEvent::Resize)
|
||||
{
|
||||
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
if (hv->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive)
|
||||
#else
|
||||
if (hv->resizeMode(m_columnToStretch) == QHeaderView::Interactive)
|
||||
#endif
|
||||
{
|
||||
QResizeEvent *re = static_cast<QResizeEvent*>(ev);
|
||||
int diff = re->size().width() - re->oldSize().width() ;
|
||||
|
|
|
@ -154,8 +154,12 @@ int main(int argc, char *argv[])
|
|||
const char* libPath = LC_INSTALL_PREFIX"/share/leocad/";
|
||||
#endif
|
||||
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
QStringList cachePathList = QStandardPaths::standardLocations(QStandardPaths::CacheLocation);
|
||||
QString cachePath = cachePathList.first();
|
||||
#else
|
||||
QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
|
||||
#endif
|
||||
|
||||
QDir dir;
|
||||
dir.mkdir(cachePath);
|
||||
|
|
Loading…
Reference in a new issue