Skip to content

Commit 76b0ab9

Browse files
committed
add qt6 support
1 parent 5939265 commit 76b0ab9

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ set(CMAKE_AUTORCC ON)
1111
set(CMAKE_CXX_STANDARD 11)
1212
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1313

14-
find_package(Qt5 COMPONENTS Widgets REQUIRED)
14+
set(Qt5_in_use true)
15+
find_package(Qt5 COMPONENTS Widgets QUIET)
16+
if (NOT Qt5_FOUND)
17+
set(Qt5_in_use false)
18+
find_package(Qt6 COMPONENTS Widgets REQUIRED)
19+
endif ()
1520

1621
if (APPLE)
1722
set(MACOSX_BUNDLE_BUNDLE_NAME Qldd)
@@ -33,11 +38,14 @@ set(SOURCES
3338
finfdialog.ui
3439
)
3540
target_sources(Qldd PRIVATE ${SOURCES})
36-
target_link_libraries(Qldd PRIVATE Qt5::Widgets)
37-
41+
if (Qt5_in_use)
42+
target_link_libraries(Qldd PRIVATE Qt5::Widgets)
43+
else ()
44+
target_link_libraries(Qldd PRIVATE Qt6::Widgets)
45+
endif ()
3846
install(TARGETS Qldd
39-
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
40-
BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
47+
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
48+
BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
4149
COMPONENT DependencyViewer)
4250

4351
install(FILES ${CMAKE_SOURCE_DIR}/nemo/actions/dependency-viewer.nemo_action

mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ MainWindow::MainWindow(const QString &fileName, QWidget *parent)
3434
shortcutClose = new QShortcut(QKeySequence(Qt::Key_Escape), this);
3535
connect(shortcutClose, SIGNAL(activated()), this, SLOT(myClose()));
3636

37-
shortcutFind = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F), this);
37+
shortcutFind = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), this);
3838
connect(shortcutFind, SIGNAL(activated()), this, SLOT(find()));
3939

4040
createActions();

qldd.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ QLdd::QLdd(QString fileName, QString lddDirPath)
5656
_otherMod.write = _fileInfo.permission(QFile::WriteOther);
5757
_otherMod.execute = _fileInfo.permission(QFile::ExeOther);
5858

59-
_tmCreate = _fileInfo.created().toString(Qt::RFC2822Date);
59+
_tmCreate = _fileInfo.birthTime().toString(Qt::RFC2822Date);
6060
_tmAccess = _fileInfo.lastRead().toString(Qt::RFC2822Date);
6161
_tmModify = _fileInfo.lastModified().toString(Qt::RFC2822Date);
6262

@@ -127,7 +127,7 @@ void QLdd::fillDependency(QTreeWidget &treeWidget) {
127127
#ifdef __APPLE__
128128
if (!flag) {
129129
flag = true;
130-
item->setTextColor(0, Qt::magenta);
130+
item->setForeground(0, QBrush(Qt::magenta));
131131
item->setText(0, sl.first());
132132
} else {
133133
item->setText(0, "# " + sl.first());
@@ -144,7 +144,7 @@ void QLdd::fillDependency(QTreeWidget &treeWidget) {
144144
for (const QString &v : sl) {
145145
if (!v.trimmed().isEmpty()) {
146146
if (v.contains("not found")) {
147-
tmp->setTextColor(0, redC);
147+
item->setForeground(0, QBrush(redC));
148148
tmp->setText(0, tmp->text(0) + " " + v);
149149
tmp->setToolTip(0, tmp->text(0));
150150
} else {
@@ -177,12 +177,12 @@ void QLdd::fillExportTable(QListWidget &listWidget, const QString &filter) {
177177
demangled.replace(":__cxx11:", "");
178178
demangled.replace("std::basic_string<char, std::char_traits<char>, std::allocator<char> >", "std::string");
179179
}
180-
QScopedPointer<QListWidgetItem> item(new QListWidgetItem(info.at(0) + " " + demangled));
180+
std::unique_ptr<QListWidgetItem> item(new QListWidgetItem(info.at(0) + " " + demangled));
181181
item->setToolTip(demangled);
182182
if (!filter.isEmpty() && demangled.contains(filter, Qt::CaseInsensitive)) {
183-
listWidget.addItem(item.take());
183+
listWidget.addItem(item.release());
184184
} else if (filter.isEmpty()) {
185-
listWidget.addItem(item.take());
185+
listWidget.addItem(item.release());
186186
}
187187
});
188188
}

0 commit comments

Comments
 (0)