A second option.
The only way I can think of to ensure this works as you require is to modify the source code and build notepadqq yourself. This is because, Qt decides if a native dialog is used unless the developer overrides this behaviour (which isn't the case here).
These steps will guide you through this process.
Remove the notepadqq snap
sudo snap remove notepadqq
Install prerequisites
sudo apt install git build-essential
sudo apt install qt5-default qttools5-dev-tools qtwebengine5-dev libqt5websockets5-dev libqt5svg5 libqt5svg5-dev
Download the notepadqq source
cd ~/Downloads
git clone --recursive https://github.com/notepadqq/notepadqq.git
Create the patch file
I've written a patch file to make it easier to make the required modifications. This patch file will force the use of a non-native dialog.
Open a new file in a text editor, copy the following and then paste it into the text editor. Save the document as notepadqq.patch
in ~/Downloads
. Make sure you copy the entire file exactly.
--- mainwindow.cpp 2018-07-29 13:42:51.758184000 +0100
+++ mainwindow_patched.cpp 2018-07-29 13:53:06.888952000 +0100
@@ -845,7 +845,7 @@
tr("Open"),
defaultUrl,
tr("All files (*)"),
- 0, 0);
+ 0, QFileDialog::DontUseNativeDialog);
if (fileNames.empty())
return;
@@ -866,7 +866,7 @@
BackupServicePauser bsp; bsp.pause();
// Select directory
- QString folder = QFileDialog::getExistingDirectory(this, tr("Open Folder"), defaultUrl.toLocalFile(), 0);
+ QString folder = QFileDialog::getExistingDirectory(this, tr("Open Folder"), defaultUrl.toLocalFile(), QFileDialog::DontUseNativeDialog);
if (folder.isEmpty())
return;
@@ -1052,7 +1052,7 @@
tr("Save as"),
getSaveDialogDefaultFileName(tabWidget, tab).toLocalFile(),
tr("Any file (*)"),
- nullptr, nullptr);
+ nullptr, QFileDialog::DontUseNativeDialog);
if (filename != "") {
m_settings.General.setLastSelectedDir(QFileInfo(filename).absolutePath());
@@ -2463,7 +2463,7 @@
// See https://github.com/notepadqq/notepadqq/issues/654
BackupServicePauser bsp; bsp.pause();
- QString file = QFileDialog::getOpenFileName(this, tr("Extension"), QString(), "Notepadqq extensions (*.nqqext)");
+ QString file = QFileDialog::getOpenFileName(this, tr("Extension"), QString(), "Notepadqq extensions (*.nqqext)", nullptr, QFileDialog::DontUseNativeDialog);
if (!file.isNull()) {
Extensions::InstallExtension *installExt = new Extensions::InstallExtension(file, this);
installExt->exec();
@@ -2547,7 +2547,7 @@
tr("Open Session..."),
recentFolder,
tr("Session file (*.xml);;Any file (*)"),
- 0, 0);
+ 0, QFileDialog::DontUseNativeDialog);
if (filePath.isEmpty())
return;
@@ -2574,6 +2574,7 @@
dialog.setFileMode(QFileDialog::AnyFile);
dialog.setDefaultSuffix("xml");
dialog.setAcceptMode(QFileDialog::AcceptSave);
+ dialog.setOption(QFileDialog::DontUseNativeDialog);
if (!dialog.exec())
return;
Apply the patch file
cd ~/Downloads
patch ~/Downloads/notepadqq/src/ui/mainwindow.cpp notepadqq.patch
Build and install notepadqq
cd ~/Downloads/notepadqq
./configure --prefix /usr
make
sudo make install
To make command nqq work (optional)
sudo ln -s /usr/bin/notepadqq /usr/bin/nqq
Launch notepadqq. Now, you should have what you had before but the open/save dialog should be non-native.
I did notice that the icon for notepadqq does not appear. If I find out how to fix that, I'll update the answer.
Hope that helps.
Update for icon
It looks like the icon cache has to be updated as follows.
sudo gtk-update-icon-cache /usr/share/icons/hicolor/
The icon is displayed correctly once this command has been executed.
gsxruk, thank you for answering. I do not understand your question.
I think my answers to your questions are:
You can see what my desktop looks like here: https://pasteboard.co/HwyQRbr.png
Also, I have not installed or used qt5ct.
– RalphShnelvar Jul 28 '18 at 14:56