Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: compact mode build faild on low dtkgui version. #102

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions libimageviewer/viewpanel/viewpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ QString ss(const QString &text, const QString &defaultValue)
int titleBarHeight()
{
// DTK 在 5.6.4 后提供紧凑模式接口,调整控件大小
#if DTK_VERSION_CHECK(5, 6, 4, 0) <= DTK_VERSION_CHECK(DTK_VERSION_MAJOR, DTK_VERSION_MINOR, DTK_VERSION_PATCH, DTK_VERSION_BUILD)
int checkVersion = DTK_VERSION_CHECK(5, 6, 4, 0);
if (checkVersion <= dtkVersion() && DGuiApplicationHelper::isCompactMode()) {
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::isCompactMode()) {
return COMPACT_TITLEBAR_HEIGHT;
} else {
return TITLEBAR_HEIGHT;
Expand Down Expand Up @@ -269,18 +268,15 @@ void LibViewPanel::initConnect()
connect(m_dirWatcher, &QFileSystemWatcher::directoryChanged, this, &LibViewPanel::slotsDirectoryChanged);

// DTK 在 5.6.4 后提供紧凑模式接口,调整控件大小
#if DTK_VERSION_CHECK(5, 6, 4, 0) <= DTK_VERSION_CHECK(DTK_VERSION_MAJOR, DTK_VERSION_MINOR, DTK_VERSION_PATCH, DTK_VERSION_BUILD)
int checkVersion = DTK_VERSION_CHECK(5, 6, 4, 0);
if (checkVersion <= dtkVersion()) {
connect(DGuiApplicationHelper::instance(),
&DGuiApplicationHelper::sizeModeChanged,
this,
[this](DGuiApplicationHelper::SizeMode) {
m_topToolbar->resize(width(), titleBarHeight());
m_topToolbar->move(0, 0);
m_topToolbar->update();
});
}
#ifdef DTKWIDGET_CLASS_DSizeMode
connect(DGuiApplicationHelper::instance(),
&DGuiApplicationHelper::sizeModeChanged,
this,
[this](DGuiApplicationHelper::SizeMode) {
m_topToolbar->resize(width(), titleBarHeight());
m_topToolbar->move(0, 0);
m_topToolbar->update();
});
#endif
}

Expand Down
5 changes: 2 additions & 3 deletions libimageviewer/widgets/toptoolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ const int COMPACT_BURSH_TEXTURE_HEIGHT = 60;
int paintBrushHeight()
{
// DTK 在 5.6.4 后提供紧凑模式接口,调整控件大小
#if DTK_VERSION_CHECK(5, 6, 4, 0) <= DTK_VERSION_CHECK(DTK_VERSION_MAJOR, DTK_VERSION_MINOR, DTK_VERSION_PATCH, DTK_VERSION_BUILD)
int checkVersion = DTK_VERSION_CHECK(5, 6, 4, 0);
if (checkVersion <= dtkVersion() && DGuiApplicationHelper::isCompactMode()) {
#ifdef DTKWIDGET_CLASS_DSizeMode
if (DGuiApplicationHelper::isCompactMode()) {
return COMPACT_BURSH_TEXTURE_HEIGHT;
} else {
return BRUSH_TEXTURE_HEIGHT;
Expand Down