Skip to content

Commit 5d032b0

Browse files
committed
fixes for compiling with QT6
1 parent 584282f commit 5d032b0

File tree

5 files changed

+38
-13
lines changed

5 files changed

+38
-13
lines changed

apps/cmstapp/code/control_box/controlbox.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ DEALINGS IN THE SOFTWARE.
5757
# include <QColorDialog>
5858
# include <QPainter>
5959
# include <QImage>
60-
# include <QDesktopWidget>
60+
# if QT_VERSION < 0x060000
61+
# include <QDesktopWidget>
62+
# endif
6163
# include <QInputDialog>
6264
# include <QDateTime>
6365

@@ -216,7 +218,11 @@ ControlBox::ControlBox(const QCommandLineParser& parser, QWidget *parent)
216218
}
217219

218220
// Make sure the controlbox will fit onto small screens (& resize to sizeHint() for HiDPI screens)
219-
QSize sz_target = (qApp->desktop()->availableGeometry(this)).size();
221+
# if QT_VERSION < 0x060000
222+
QSize sz_target = (qApp->desktop()->availableGeometry(this)).size();
223+
# else
224+
QSize sz_target = qApp->primaryScreen()->availableGeometry().size();
225+
# endif
220226
QSize sz_source = this->sizeHint();
221227
if (sz_source.width() > sz_target.width() || sz_source.height() > sz_target.height() ) {
222228
sz_source.scale(sz_target.width() - 100, sz_target.height() - 100, Qt::KeepAspectRatio); // keep min. 100 pixels around dialog
@@ -1752,7 +1758,11 @@ void ControlBox::getServiceDetails(int index)
17521758
QMap<QString,QVariant> submap;
17531759

17541760
// Get a QFileInfo associated with the index and display the connection
1755-
QFileInfo fi = services_list.at(index).objpath.path();
1761+
# if QT_VERSION < 0x060000
1762+
QFileInfo fi = services_list.at(index).objpath.path();
1763+
# else
1764+
QFileInfo fi(services_list.at(index).objpath.path());
1765+
# endif
17561766
ui.label_details_connection->setText(tr("<b>Connection:</b> %1").arg(fi.baseName()) );
17571767

17581768
// Start building the string for the left label
@@ -2094,7 +2104,11 @@ void ControlBox::assembleTabStatus()
20942104
ui.tableWidget_services->setItem(row, 2, qtwi02);
20952105

20962106
QTableWidgetItem* qtwi03 = new QTableWidgetItem();
2097-
QFileInfo fi = services_list.at(row).objpath.path();
2107+
# if QT_VERSION < 0x060000
2108+
QFileInfo fi = services_list.at(row).objpath.path();
2109+
# else
2110+
QFileInfo fi(services_list.at(row).objpath.path());
2111+
# endif
20982112
qtwi03->setText(fi.baseName() );
20992113
qtwi03->setTextAlignment(Qt::AlignVCenter|Qt::AlignLeft);
21002114
ui.tableWidget_services->setItem(row, 3, qtwi03);
@@ -2345,7 +2359,11 @@ void ControlBox::assembleTabVPN()
23452359
ui.tableWidget_vpn->setCellWidget(rowcount, 3, ql03);
23462360

23472361
QLabel* ql04 = new QLabel(ui.tableWidget_vpn);
2348-
QFileInfo fi = services_list.at(row).objpath.path();
2362+
# if QT_VERSION < 0x060000
2363+
QFileInfo fi = services_list.at(row).objpath.path();
2364+
# else
2365+
QFileInfo fi(services_list.at(row).objpath.path());
2366+
# endif
23492367
ql04->setText(fi.baseName() );
23502368
ql04->setAlignment(Qt:: AlignCenter);
23512369
ui.tableWidget_vpn->setCellWidget(rowcount, 4, ql04);

apps/cmstapp/code/main.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ void signalhandler(int sig) {
5454

5555
int main(int argc, char *argv[])
5656
{
57-
// set core application attributes
57+
58+
# if QT_VERSION < 0x060000
5859
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
59-
// #if QT_VERSION >= 0x050600
60-
// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
61-
// #endif
60+
# endif
6261

6362
QApplication::setApplicationName(LONG_NAME);
6463
QApplication::setApplicationVersion(VERSION);
@@ -169,8 +168,13 @@ int main(int argc, char *argv[])
169168

170169
// Setup translations
171170
QTranslator qtTranslator;
172-
qtTranslator.load("qt_" + QLocale::system().name(),
173-
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
171+
# if QT_VERSION < 0x060000
172+
qtTranslator.load("qt_" + QLocale::system().name(),
173+
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
174+
# else
175+
(void) qtTranslator.load("qt_" + QLocale::system().name(),
176+
QLibraryInfo::path(QLibraryInfo::TranslationsPath));
177+
# endif
174178
app.installTranslator(&qtTranslator);
175179

176180
QTranslator cmstTranslator;

apps/cmstapp/code/vpn_agent/vpnagent_adaptor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ class QByteArray;
1919
template<class T> class QList;
2020
template<class Key, class Value> class QMap;
2121
class QString;
22-
class QStringList;
22+
# if QT_VERSION < 0x060000
23+
class QStringList;
24+
# endif
2325
class QVariant;
2426
QT_END_NAMESPACE
2527

apps/resource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ DEALINGS IN THE SOFTWARE.
3434
///////////////////////////////// Program Values ///////////////////////
3535
//
3636
// Program Info (may be visible, but don't mark for tranalation)
37-
#define VERSION "2022.11.20-1"
37+
#define VERSION "2022.11.20-2"
3838

3939
#define RELEASE_DATE "1 May 2022"
4040
#define COPYRIGHT_DATE "2013-2022"

text/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<b><center>Change Log</center></b>
33
<b> In Progress</b>
44
<ul>
5+
<li>Changes to allow compile with QT6 (PR #278 from kitsnotes).</li>
56
<li>Numerous translation updates</li>
67
<li>All columns can be resized in the Technologies windows in the Status tab.</li>
78
</ul>

0 commit comments

Comments
 (0)