Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Native QColorDialog, Issue
Qt 6.12 LTS is out! See what's new in the release blog

Native QColorDialog, Issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 559 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    angeleyes
    wrote on last edited by
    #1

    Hello everyone!
    system: Ubuntu 22.04
    qt version: 6.2.4
    my app: https://github.com/try-hard-factory/familiar
    color picker library: https://github.com/ksnip/kColorPicker
    (this library for qt5, but I updated it for qt 6)

    When I try to call the dialog, the dialog box is created but not displayed. The interface is also blocked (you cannot close the window for example): (select color window)
    Screenshot from 2023-06-17 16-32-15.png

    in the sample library everything works as it should:
    Screenshot from 2023-06-17 16-32-44.png

    I changed the library code and added a flag QColorDialog::DontUseNativeDialog

    void ColorDialogButton::buttonClicked()
    {
        auto color = QColorDialog::getColor(Qt::white, this, QString(), QColorDialog::DontUseNativeDialog | getColorDialogOptions());
        emit colorSelected(color);
    }
    

    and it helped:
    Screenshot from 2023-06-17 16-37-06.png

    I want to understand why this is happening. Perhaps I'm adding the color widget incorrectly?
    Some code for understanding what's going on:

    color picker example:

    int main(int argc, char **argv)
    {
        QApplication app(argc, argv);
        auto widget = new QWidget();
        widget->setFixedWidth(200);
        widget->setFixedHeight(200);
        auto layout = new QVBoxLayout();
        auto colorPicker = new KColorPicker(true);
        colorPicker->setColor(QColor(Qt::red));
        layout->addWidget(colorPicker);
        widget->setLayout(layout);
        widget->show();
    
        return app.exec();
    }
    

    my code:

    SettingsWindow::SettingsWindow(MainWindow* wm, QWidget* parent)
    ...
        , colorsTab_(new QWidget)
        , colors_(new ColorsWidget(colorsTab_))
    ...
    {
       ...
    
        // colors
        auto* colorsLayout = new QVBoxLayout(colorsTab_);
        colorsTab_->setLayout(colorsLayout);
        colorsLayout->addWidget(colors_);
        tabWidget_->addTab(colorsTab_, tr("Colors"));
    
     ...
    }
    
    ColorsWidget::ColorsWidget(QWidget* parent)
        : QWidget(parent)
        , layout_(new QVBoxLayout(this))
    {
        layout_->setAlignment(Qt::AlignTop);
        auto colorPicker = new KColorPicker(true);
        colorPicker->setColor(QColor(Qt::red));
        layout_->addWidget(colorPicker);
        setLayout(layout_);
    }
    

    regards, max

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved