I have two versions of Ubuntu running on different VMs under VMWare workstation: 16.04 and 18.04.

I really dislike the file open/save interface I have on 18.05 and I like the one I have on 16.04. I assume the issue is the different versions of Qt running.

On 16.04 I seem to be running Notepadqq v.1.4.2 and Qt 5.5.1

On 18.04 I seem to be running Notepadqq v.1.4.2 and Qt 5.9.5

That is, the same version of Notepadqq but different versions of Qt.

When I do a

whereis qt

in both VMs, I get "nothing" back. All I see is


Is my assumption correct? Is the cause of the different file open/save GUI due to a difference in qt versions or is it a difference in OS (16.04 v 18.04) versions?

If it is a difference in Qt versions, how do I go from Qt version 5.9.5 back to 5.5.1 in my 18.04 VM?

  • What desktop environment are you using? Have you amended the style used by Qt? – gsxruk Jul 28 '18 at 11:12
  • gsxruk, thank you for answering. I do not understand your question. – RalphShnelvar Jul 28 '18 at 14:14
  • (Sorry for the repeat. I took more than 5 minutes to edit this answer.) gsxruk, thank you for answering. I do not understand your question. I think my answers to your questions are: 1) Gnome. How does one determine what the desktop environment is for sure? 2) How does one amend the style used by Qt? Are you referring to pcsuggest.com/qt5ct-change-qt5-application-style ? – RalphShnelvar Jul 28 '18 at 14:23
  • If you go to "Settings" and then "About" you will see Gnome somewhere in there if you are using Gnome. Have you changed anything using qt5ct? The reason I ask, is that when I lauch Notepadqq in 16.04 and 18.04, I see no difference in the open/save dialog. – gsxruk Jul 28 '18 at 14:39
  • Sigh. There is nothing in "About" about Gnome in settings. You can see what my desktop looks like here: pasteboard.co/HwyQRbr.png Also, I have not installed or used qt5ct. – RalphShnelvar Jul 28 '18 at 14:56

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("All files (*)"),
-                                0, 0);
+                                0, QFileDialog::DontUseNativeDialog);

     if (fileNames.empty())
@@ -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())

@@ -1052,7 +1052,7 @@
                            tr("Save as"),
                            getSaveDialogDefaultFileName(tabWidget, tab).toLocalFile(),
                            tr("Any file (*)"),
-                           nullptr, nullptr);
+                           nullptr, QFileDialog::DontUseNativeDialog);

     if (filename != "") {
@@ -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);
@@ -2547,7 +2547,7 @@
                            tr("Open Session..."),
                            tr("Session file (*.xml);;Any file (*)"),
-                           0, 0);
+                           0, QFileDialog::DontUseNativeDialog);

     if (filePath.isEmpty())
@@ -2574,6 +2574,7 @@
+    dialog.setOption(QFileDialog::DontUseNativeDialog);

     if (!dialog.exec())

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
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.

  • Utterly, absolutely amazing! @gsxruk! It works!!! Thank you, thank you, thank you! – RalphShnelvar Jul 29 '18 at 15:40
  • No problem and pleased it worked for you. And if that's the case, please mark it as the answer. – gsxruk Jul 29 '18 at 15:45
  • I wish I could upvote your answer ... but I have fewer than 15 reputation points. – RalphShnelvar Jul 29 '18 at 15:48
  • While I have your attention, @gsxruk, I am just now reading askubuntu.com/questions/270006/… . Do you recommend I use gksu/gksudo rather than sudo to launch nqq when I need root privileges? – RalphShnelvar Jul 29 '18 at 16:00
  • I've always been a little unsure on that too and I thought it was deprecated/obsolete these days. I don't really use it, I always use vi when I'm amending root files. This article may be of interest and it looks up to date. – gsxruk Jul 29 '18 at 16:17

I'm not 100% sure why, but it looks like the application GUI behaves differently when installed using the PPA compared to when it is installed as a snap. I have seen this with another application.

If you carry out the following steps, you should end up with notepadqq using a non-native open/save dialog in Ubuntu 18.04.

Uninstall the current notepadqq

sudo apt remove notepadqq

Clean up the system by removing the PPA

sudo add-apt-repository -r ppa:notepadqq-team/notepadqq
sudo apt update

Install notepadqq as a snap

sudo snap install notepadqq

Launch notepadqq and check the open/save dialog. On my system, the non-native dialog appears.

  • I think you'll find those error messages were present anyway. They were on mine in both cases. But that may be a question you need to raise with the developer. – gsxruk Jul 29 '18 at 12:07
  • (I'm sorry I deleted my comment after you answered. Here's my comment again.) Wow, that worked! The only two changes - and they are minor annoyances - are (1) that I can only launch with "notepadqq" rather than "nqq". (2) I'm getting error messages when I launch notepadqq. See pasteboard.co/HwH98Tw.png for the error messages. – RalphShnelvar Jul 29 '18 at 12:12
  • (a) @gsxruk, Thank you so much!!! (b) Do you know how to contact the developer? – RalphShnelvar Jul 29 '18 at 12:13
  • A good place to start would be the project website here. You should be able to raise an issue. – gsxruk Jul 29 '18 at 12:18
  • Ok, another problem. "sudo notepadqq --allow-root" no longer works. Sigh. – RalphShnelvar Jul 29 '18 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.