How to fix the VirtualBox 5.2 Qt theme (17.10+)

VirtualBox 5.2 introduced a new change in how it renders the Qt interface. This means that once you install the application, you may find it looks completely out of line with the rest of the system:

There's a way to fix it -- but only in 17.10 and up!

Before

Steps

In a terminal:

  1. Install qt5-style-plugins

     sudo apt install qt5-style-plugins
    
  2. Open /etc/environment as root:

     sudo nano /etc/environment
    
  3. Paste the following line at the end of the file:

     export QT_QPA_PLATFORMTHEME=gtk2
    

    If you're unfamiliar with the terminal, copy the line above and press CTRL + Shift + V to paste it, then press CTRL + X to save then press Y to confirm.

  4. Log out and log back in to apply the changes.

After

2 Likes

Fresh install of Ubuntu MATE 17.10 performed a few days after the official release, and up-to-date (via "Software Updater"). Linux Kernel 15.1 (installed by using ukuu).
For me, VirutalBox 5.2.6 looks ok (theme), without having to perform any action.

I get this following error while launching Qt5 settings (qt5ct). What am I missing?

I followed your instructions:
sudo apt install qt5-style-plugins
sudo nano /etc/environment - ie, 'export QT_QPA_PLATFORMTHEME=gtk2' at the end of the file.

However I did not log out and log back in.
Is there no other way to set the Qt5 theme for VirtualBox 5.2.6?

By the way I'm using Linux Mint 18.3 MATE edition.

If that variable is causing a problem, try unassigning it and add that to /etc/environment:

unset QT_STYLE_OVERRIDE
qt5ct

Anything changed in /etc/environment requires you to log out and back in.

I haven’t tried the Qt5 settings program, nor am I aware of any other way to set the Qt5 theme for VirtualBox.