fix: 修复在 wayland 下 dock 无法使用的问题;
This commit is contained in:
parent
f299b75198
commit
e374f759e5
|
@ -171,7 +171,8 @@ QHexView::QHexView(QWidget *parent)
|
|||
f.setStyleHint(QFont::TypeWriter);
|
||||
}
|
||||
|
||||
m_fontSize = f.pointSizeF();
|
||||
m_fontSize = qApp->font().pointSizeF();
|
||||
f.setPointSizeF(m_fontSize);
|
||||
m_cursor = new QHexCursor(this);
|
||||
|
||||
this->setFont(f);
|
||||
|
@ -554,7 +555,7 @@ bool QHexView::copy(bool hex) {
|
|||
qreal QHexView::fontSize() const { return m_fontSize; }
|
||||
|
||||
void QHexView::setScaleRate(qreal rate) {
|
||||
if (rate >= 0.2 && rate < 2.01) {
|
||||
if (rate >= 0.2 && rate < 3.01) {
|
||||
m_scaleRate = rate;
|
||||
setFontSize(fontSize());
|
||||
emit scaleRateChanged();
|
||||
|
@ -576,7 +577,6 @@ void QHexView::setFontSize(qreal size) {
|
|||
auto font = this->font();
|
||||
font.setPointSizeF(size * m_scaleRate);
|
||||
this->setFont(font);
|
||||
m_fontSize = size;
|
||||
}
|
||||
|
||||
QColor QHexView::selectionColor() const { return m_renderer->selectionColor(); }
|
||||
|
|
|
@ -410,72 +410,72 @@
|
|||
<context>
|
||||
<name>EditorView</name>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="82"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="83"/>
|
||||
<source>Cut</source>
|
||||
<translation>剪切</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="84"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="85"/>
|
||||
<source>CutHex</source>
|
||||
<translation>剪切(十六进制)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="86"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="87"/>
|
||||
<source>Copy</source>
|
||||
<translation>复制</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="88"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="89"/>
|
||||
<source>CopyHex</source>
|
||||
<translation>复制(十六进制)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="90"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="91"/>
|
||||
<source>Paste</source>
|
||||
<translation>粘贴</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="92"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="93"/>
|
||||
<source>PasteHex</source>
|
||||
<translation>粘贴(十六进制)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="94"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="95"/>
|
||||
<source>Delete</source>
|
||||
<translation>删除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="97"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="98"/>
|
||||
<source>Find</source>
|
||||
<translation>查找</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="99"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="100"/>
|
||||
<source>Goto</source>
|
||||
<translation>跳转</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="101"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="102"/>
|
||||
<source>Fill</source>
|
||||
<translation>填充</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="103"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="104"/>
|
||||
<source>MetaData</source>
|
||||
<translation>标注</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="105"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="106"/>
|
||||
<source>BookMark</source>
|
||||
<translation>书签</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="294"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="295"/>
|
||||
<source>Untitled</source>
|
||||
<translation>未命名</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="878"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="879"/>
|
||||
<source>Not allowed operation in non-UI thread</source>
|
||||
<translation>该操作在非 UI 线程非法</translation>
|
||||
</message>
|
||||
|
@ -2617,17 +2617,17 @@
|
|||
<context>
|
||||
<name>QHexView</name>
|
||||
<message>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="270"/>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="271"/>
|
||||
<source>Foreground:</source>
|
||||
<translation>前景色:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="281"/>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="282"/>
|
||||
<source>Background:</source>
|
||||
<translation>背景色:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="288"/>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="289"/>
|
||||
<source>Comment:</source>
|
||||
<translation>说明:</translation>
|
||||
</message>
|
||||
|
|
|
@ -410,72 +410,72 @@
|
|||
<context>
|
||||
<name>EditorView</name>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="82"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="83"/>
|
||||
<source>Cut</source>
|
||||
<translation>剪切</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="84"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="85"/>
|
||||
<source>CutHex</source>
|
||||
<translation>剪切(十六進制)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="86"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="87"/>
|
||||
<source>Copy</source>
|
||||
<translation>複製</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="88"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="89"/>
|
||||
<source>CopyHex</source>
|
||||
<translation>複製(十六進制)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="90"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="91"/>
|
||||
<source>Paste</source>
|
||||
<translation>粘貼</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="92"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="93"/>
|
||||
<source>PasteHex</source>
|
||||
<translation>粘貼(十六進制)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="94"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="95"/>
|
||||
<source>Delete</source>
|
||||
<translation>刪除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="97"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="98"/>
|
||||
<source>Find</source>
|
||||
<translation>查找</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="99"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="100"/>
|
||||
<source>Goto</source>
|
||||
<translation>跳轉</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="101"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="102"/>
|
||||
<source>Fill</source>
|
||||
<translation>填充</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="103"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="104"/>
|
||||
<source>MetaData</source>
|
||||
<translation>標注</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="105"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="106"/>
|
||||
<source>BookMark</source>
|
||||
<translation>書簽</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="294"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="295"/>
|
||||
<source>Untitled</source>
|
||||
<translation>未命名</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/editorview.cpp" line="878"/>
|
||||
<location filename="../../src/control/editorview.cpp" line="879"/>
|
||||
<source>Not allowed operation in non-UI thread</source>
|
||||
<translation>該操作在非 UI 線程非法</translation>
|
||||
</message>
|
||||
|
@ -2617,17 +2617,17 @@
|
|||
<context>
|
||||
<name>QHexView</name>
|
||||
<message>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="270"/>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="271"/>
|
||||
<source>Foreground:</source>
|
||||
<translation>前景色:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="281"/>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="282"/>
|
||||
<source>Background:</source>
|
||||
<translation>背景色:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="288"/>
|
||||
<location filename="../../3rdparty/QHexView/qhexview.cpp" line="289"/>
|
||||
<source>Comment:</source>
|
||||
<translation>說明:</translation>
|
||||
</message>
|
||||
|
|
12
main.cpp
12
main.cpp
|
@ -20,6 +20,18 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// fix wayland issue (a workaround): floating dock not work
|
||||
// reference:
|
||||
// https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/
|
||||
// issues/714#issuecomment-2802752677
|
||||
auto denv = qgetenv("XDG_SESSION_TYPE");
|
||||
if (denv.isEmpty() ||
|
||||
denv.compare(QByteArrayLiteral("wayland"), Qt::CaseInsensitive) == 0) {
|
||||
qputenv("QT_QPA_PLATFORM", "xcb");
|
||||
}
|
||||
#endif
|
||||
|
||||
QApplication::setApplicationName(APP_NAME);
|
||||
QApplication::setOrganizationName(APP_ORG);
|
||||
QApplication::setApplicationVersion(WINGHEX_VERSION);
|
||||
|
|
|
@ -63,7 +63,8 @@ EditorView::EditorView(QWidget *parent)
|
|||
auto hexLayout = new QVBoxLayout(m_hexContainer);
|
||||
hexLayout->setSpacing(0);
|
||||
hexLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_hex = new QHexView;
|
||||
m_hex = new QHexView(this);
|
||||
|
||||
hexLayout->addWidget(m_hex, 1);
|
||||
m_goto = new GotoWidget(this);
|
||||
connect(m_goto, &GotoWidget::jumpToLine, this,
|
||||
|
|
Loading…
Reference in New Issue