Results 1 to 2 of 2

Thread: KDE Plasma HiDPI icons

  1. #1
    Join Date
    Apr 2013
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default KDE Plasma HiDPI icons

    I'm trying to understand why some icons are displayed correctly and some other not on a HiDPI display

    Qt 5.15.2
    KDE Plasma 5.23.90
    2880 x 1800 display

    Qt Code:
    1. #include "mainwindow.hpp"
    2. #include <QApplication>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. MainWindow w;
    8. w.setWindowTitle("HiDPI test");
    9. w.show();
    10. return a.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. #ifndef MAINWINDOW_HPP
    2. #define MAINWINDOW_HPP
    3.  
    4. #include <QFileDialog>
    5. #include <QMainWindow>
    6. #include <QStandardPaths>
    7. #include <QStatusBar>
    8. #include <QToolBar>
    9. #include <QVBoxLayout>
    10.  
    11. class MainWindow : public QMainWindow
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. MainWindow(QWidget *parent = nullptr);
    17.  
    18. private Q_SLOTS:
    19. void settings();
    20.  
    21. private:
    22. QToolBar *tool_bar_;
    23. QAction *add_media_;
    24. QAction *remove_media_;
    25. QAction *get_info_;
    26. QAction *download_medias_;
    27. QAction *settings_action_;
    28. QStatusBar *status_bar_;
    29. };
    30.  
    31. #endif
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. #include "mainwindow.hpp"
    2.  
    3. MainWindow::MainWindow(QWidget *parent)
    4. : QMainWindow(parent)
    5. {
    6. QWidget *central_widget = new QWidget(this);
    7. QVBoxLayout *layout = new QVBoxLayout;
    8. central_widget->setLayout(layout);
    9. setCentralWidget((central_widget));
    10.  
    11. status_bar_ = new QStatusBar;
    12. tool_bar_ = new QToolBar;
    13. add_media_ = new QAction(QIcon::fromTheme("list-add"), "Add", this);
    14. remove_media_ = new QAction(QIcon::fromTheme("list-remove"), "Remove", this);
    15. get_info_ = new QAction(QIcon::fromTheme("documentinfo"), "Information", this);
    16. download_medias_ = new QAction(QIcon::fromTheme("download"), "Download", this);
    17. settings_action_ = new QAction(QIcon::fromTheme("settings-configure"), "Settings", this);
    18. connect(settings_action_, &QAction::triggered, this, &MainWindow::settings);
    19.  
    20. tool_bar_->addAction(add_media_);
    21. tool_bar_->addAction(remove_media_);
    22. tool_bar_->addSeparator();
    23. tool_bar_->addAction(get_info_);
    24. tool_bar_->addSeparator();
    25. tool_bar_->addAction(download_medias_);
    26. tool_bar_->addSeparator();
    27. tool_bar_->addAction(settings_action_);
    28.  
    29. layout->addWidget(tool_bar_);
    30. layout->addWidget(status_bar_);
    31. }
    32.  
    33. void MainWindow::settings()
    34. {
    35. QFileDialog *file_dialog(new QFileDialog);
    36. file_dialog->setFileMode(QFileDialog::DirectoryOnly);
    37. QStringList download_location(QStandardPaths::standardLocations(QStandardPaths::DownloadLocation));
    38. file_dialog->exec();
    39. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. cmake_minimum_required(VERSION 3.5)
    2. project(hidpi_test)
    3. add_compile_options(-Wall -Wextra)
    4. set(CMAKE_CXX_STANDARD 14)
    5. set(CMAKE_CXX_STANDARD_REQUIRED ON)
    6.  
    7. ## Find Qt5
    8. set(CMAKE_AUTOMOC ON)
    9. find_package(Qt5Widgets REQUIRED)
    10.  
    11. add_executable(
    12. ${PROJECT_NAME}
    13. mainwindow.hpp
    14. mainwindow.cpp
    15. main.cpp
    16. )
    17. target_link_libraries(
    18. ${PROJECT_NAME}
    19. Qt5::Widgets
    20. )
    To copy to clipboard, switch view to plain text mode 

    The + (list-add) and - (list-remove) icons are perfect but the others are pixelated. When opening a QFileDialog the buttons icons (New directory, Ok, Cancel) are pixelated too.

    Screenshot_20220205_135455.jpgScreenshot_20220205_135322.png

    How can I get all the icons right?

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    487
    Thanks
    11
    Thanked 71 Times in 69 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: KDE Plasma HiDPI icons

    Hi, maybe this helps:
    https://doc.qt.io/qt-5/highdpi.html

    You probably have the same problem on your + and - icons, but simply don't see it because they consist only of straight lines, which can be scaled easily without artifacts like in the other icons with diagonal lines or round elements.

    Ginsengelf

  3. The following user says thank you to Ginsengelf for this useful post:

    Vicolaships (16th February 2022)

Similar Threads

  1. Replies: 0
    Last Post: 24th March 2017, 10:56
  2. No svg-icons
    By scary hallo in forum Installation and Deployment
    Replies: 2
    Last Post: 9th August 2016, 07:47
  3. Replies: 2
    Last Post: 8th April 2013, 06:40
  4. Where to get Icons from
    By pospiech in forum General Discussion
    Replies: 4
    Last Post: 19th December 2008, 21:14
  5. Plasma::DataEngine
    By DeepDiver in forum KDE Forum
    Replies: 0
    Last Post: 8th May 2008, 23:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.