Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 457.9k Posts
  • QSvgWidget load svg Datei, "libpng warning: iCCP: known incorrect sRGB profile"

    Unsolved
    2
    0 Votes
    2 Posts
    613 Views
    Christian EhrlicherC
    @rs_elk said in QSvgWidget load svg Datei, "libpng warning: iCCP: known incorrect sRGB profile": However, shouldn't this warning occur when loading a PNG file instead? Yes, you're loading a png somewhere.
  • fatal error: double-conversion/double-conversion.h: No such file or directory

    Unsolved
    4
    0 Votes
    4 Posts
    962 Views
    Christian EhrlicherC
    Then your source package was not completely unpacked because this header is provided by Qt: https://code.qt.io/cgit/qt/qtbase.git/tree/src/3rdparty/double-conversion/double-conversion
  • QT6 QComboBox open in drawComplexControl

    Unsolved
    7
    0 Votes
    7 Posts
    710 Views
    TrilecStudiosT
    @TrilecStudios for the sake of completeness: This is the current implementation for those interested. //a simple implementation the calls the styling function void CharcoalStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const { switch (control) { case CC_ComboBox: { setComboboxStyle(option, painter, widget ) ; break; } default: QProxyStyle::drawComplexControl(control, option, painter, widget); break; } } //the basic implementation of drawing a style for combobox void CharcoalStyle::setComboboxStyle(const QStyleOption *option, QPainter* painter, const QWidget *widget) const { const auto comboOption = qstyleoption_cast<const QStyleOptionComboBox *>(option); const auto comboBox = qobject_cast<QComboBox*>(const_cast<QWidget*>(widget)); if(!comboOption ) return; bool isDown = (option->state & QStyle::State_Sunken); bool isEnabled = (option->state & QStyle::State_Enabled); bool hasFocus = (option->state & QStyle::State_HasFocus && option->state & QStyle::State_KeyboardFocusChange); bool isOver = (option->state & QStyle::State_MouseOver); bool isOn = (option->state & QStyle::State_On); enum DESIGN { NormalDesign = 0, FlatDesign = 1, Design1 = 2, Design2 = 3 }; int design = NormalDesign; QColor bgColor = ComboboxBg; QColor fgColor = ComboboxFg; QColor borderColor = ComboBoxBorder; QColor iconColor = ComboBoxIcon; QRect rect = comboOption->rect; // prepare and load existing defaults QFont font = comboBox->font(); Qt::Alignment alignment = Qt::AlignLeft | Qt::AlignVCenter; // override any additional settings to take care of a design property being set (defined in header) if (comboBox->property(Design1Property.toStdString().c_str()).toBool()) { design = Design1; bgColor = design1Bg; fgColor = design1Fg; borderColor = design1Border; iconColor = design1Icon; } // design = NormalDesign; //defined at top of function as default // ajust the colours if it's on to being slightly brighter for on state if( isDown ) { bgColor = bgColor.lighter(140); fgColor = fgColor.lighter(110); borderColor = borderColor.lighter(110); iconColor = iconColor.lighter(110); } // ajust the colours on a disabled state adjusting saturation, lightness and transparency if( !isEnabled ) { // Convert the base color to HSL and adjust the saturation and brightness bgColor = QColor::fromHslF(bgColor.hslHueF(), bgColor.hslSaturationF() * 0.7, bgColor.lightnessF() * 0.8); fgColor = QColor::fromHslF(fgColor.hslHueF(), fgColor.hslSaturationF() * 0.7, fgColor.lightnessF() * 0.8); iconColor = QColor::fromHslF(iconColor.hslHueF(), iconColor.hslSaturationF() * 0.7, iconColor.lightnessF() * 0.8); bgColor.setAlpha(128); //a little bit of transparency borderColor = bgColor; } // ajust the colours if we are hovering over the button or widget if( isOver ) { bgColor = bgColor.lighter(112); fgColor = fgColor.lighter(112); borderColor = borderColor.lighter(112); iconColor = iconColor.lighter(112); } //setup the painter painter->save(); //painter->setRenderHint(QPainter::Antialiasing); painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); painter->setBrush(bgColor); painter->setFont(font); //path handles anti-aliasing a lot better specially for rounded QPainterPath path; // draw the appropriate style switch (design) { case Design1: path.addRect( rect ); painter->setPen(QPen( borderColor,2 )); if( isOn ) { painter->drawPath(path); drawArrow( painter, Qt::DownArrow, rect, comboOption,iconColor); } else { painter->fillPath(path, bgColor); drawArrow( painter, Qt::RightArrow, rect, comboOption,iconColor); } painter->setPen(QPen(fgColor, 1)); painter->drawText(rect.adjusted(4, 0, -18, 0), alignment, comboOption->currentText); break; default: painter->setPen(QPen( borderColor,1 )); qreal radius = option->rect.height() / 2; path.addRoundedRect(rect, radius,radius); if( isOn ) { painter->drawPath(path); painter->setBrush(bgColor); drawArrow( painter, Qt::DownArrow, rect, comboOption,iconColor); } else { painter->fillPath(path, bgColor); drawArrow( painter, Qt::RightArrow, rect, comboOption,iconColor); } painter->setPen(QPen(fgColor, 1)); painter->drawText(rect.adjusted( radius , 0, -18, 0), alignment, comboOption->currentText); break; } painter->restore(); }
  • Error trying to add Adding Qt Quick Designer Components to Qt Installation

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    M
    I found a solution to the problem. I ended up installing msys2 and through that installing mingw-w64 GCC using these commands: pacman -S mingw-w64-ucrt-x86_64-gcc pacman -S --needed base-devel mingw-w64-x86_64-toolchain This allowed me to build and install the Qt Quick Designer Components without any errors. I was still having an error with Qt Creator recognising the modules, but reinstalling resolved that, so it's all working fine now. Thanks.
  • 0 Votes
    7 Posts
    495 Views
    C
    @ankou29666 Find a simpler way to do this by creating a checkbox variable inside my label: QCheckBox* m_editModeCheckbox; Linking it with: m_editModeCheckbox(parent->findChild<QCheckBox*>("editMode")) Accessing it with: if (m_editModeCheckbox && m_editModeCheckbox->isChecked()) #include "handlabel.h" HandLabel::HandLabel(QWidget parent, QString text) : QLabel(parent) , defaultBg("background-color: rgb(191, 191, 191);") , defaultFont("Jetbrains Mono", 12) , m_editModeCheckbox(parent->findChild<QCheckBox>("editMode")) { setText(text); setAlignment(Qt::AlignCenter); setFont(defaultFont); setStyleSheet(defaultBg); } void HandLabel::enterEvent(QEnterEvent *ev) { if (m_editModeCheckbox && m_editModeCheckbox->isChecked()) { // fazer algo se o checkbox estiver marcado setStyleSheet("background-color: rgb(255, 255, 0);"); } } void HandLabel::leaveEvent(QEvent *ev) { if (m_editModeCheckbox && m_editModeCheckbox->isChecked()) { // fazer algo se o checkbox estiver marcado setStyleSheet(defaultBg); } }
  • How to trigger screen reader output independent of the focused QML item?

    Unsolved
    1
    1 Votes
    1 Posts
    141 Views
    No one has replied
  • UDP communication readyread

    Solved
    7
    0 Votes
    7 Posts
    429 Views
    D
    @JonB mayby the fact that remte device change UDP port when transmit next frames...? From 59185 (3row form log) to 12810(4,5,6...row from log) ? It can be a problem ?
  • Qt 6.4.2 Bluetooth - macOS/Windows - Adapter status

    Unsolved
    1
    0 Votes
    1 Posts
    179 Views
    No one has replied
  • waitForDone() I am not compatible with gui , gui is frozen

    Unsolved
    19
    0 Votes
    19 Posts
    4k Views
    JonBJ
    @khong-muon-them-nhieu-sai-lam So apply the same principle except that you need to count/mark off as each thread finishes so that you will know when they have all finished, then spawn off the next group of threads when the last one in the first group finishes.
  • Build Qt on Windows without debug symbols

    Solved
    3
    0 Votes
    3 Posts
    394 Views
    N
    @Chris-Kawa That was my whole point. I already requested a hardware upgrade and I will create the complete debug build when I'll have the resources. I just asked the question out of curiosity, but you're right, it is a weird configuration. Thanks.
  • This topic is deleted!

    2
    0 Votes
    2 Posts
    15 Views
  • How to get physical screen infomation when display mirror?

    Solved
    3
    0 Votes
    3 Posts
    507 Views
    B
    @Chris-Kawa Thanks.
  • Qt addin load project error, qt_defaults.props goes invalid characters error

    Unsolved
    2
    0 Votes
    2 Posts
    638 Views
    D
    Hi, I am getting the same problem, did you ever find a solution?
  • How to make the QAplication ToolTip background transparent?

    Unsolved
    2
    0 Votes
    2 Posts
    329 Views
    JoeCFDJ
    @Roberrt said in How to make the QAplication ToolTip background transparent?: background color of any tooltip try this? QApplication::setStyleSheet(styleSheet);
  • QUdpSocket can't receive data from specific interface

    Unsolved
    4
    0 Votes
    4 Posts
    445 Views
    Christian EhrlicherC
    I'm pretty sure it's the windows firewall. Try to send to a dedicated adress instead broadcast to see if it helps but QUdpSocket can handle both correctly. See also the examples and try them out: https://doc.qt.io/qt-6/qudpsocket.html#details
  • QSqlTableModel resize on edit

    Unsolved
    6
    0 Votes
    6 Posts
    430 Views
    Seb TurS
    @JonB Thanks for the proposed solution , I will give it a try.
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    3 Views
  • Error while making example file

    Unsolved
    15
    0 Votes
    15 Posts
    3k Views
    C
    @ferocito The file is built as one of the plugins in the Plug & Paint example. The example code is here and the specific sub-project that builds the library is at plugins/basictools/basictools.pro $ cd ~/Qt/Examples/Qt-6.4.2/widgets/tools/plugandpaint $ qmake $ make ... $ ls -F . plugins .: app/ CMakeLists.txt Makefile plugandpaint* plugandpaint.pro plugins/ plugins: basictools/ CMakeLists.txt extrafilters/ libpnp_basictools.a libpnp_extrafilters.so* Makefile plugins.pro
  • Importing existing project on qt design studio

    Unsolved
    3
    1 Votes
    3 Posts
    644 Views
    E
    I would also be interested in this. What is the workflow when Qt Design Studio should be used long after the Qt development started, so already a number of (cmake-based) Qt projects exist already? Can they be imported somehow?
  • How to retrieve data from an excel .csv file, and put it in a graph with QCustomPlot

    Unsolved
    34
    0 Votes
    34 Posts
    10k Views
    S
    You need to learn to read error messages more thoroughly. @Raphawel said in How to retrieve data from an excel .csv file, and put it in a graph with QCustomPlot: C:\Users\46053500\Documents\Graph_QT\graphConso\graphconso.cpp:140: error : no matching function for call to 'QCPGraph::setData(QVector<char>&, QVector<double>&)' ui->customplot->graph(0)->setData(xData2, yData2); This error message tells you that the first parameter you are handing in is of type QVector<char>. By now we have established that it should be QVector<double>. You should be able to figure out that you are passing the wrong variable here. @Raphawel said in How to retrieve data from an excel .csv file, and put it in a graph with QCustomPlot: C:\Users\46053500\Documents\Graph_QT\graphConso\graphconso.cpp:125: error : no matching function for call to 'QDateTime::fromString(QStringList&, const char [20])' referenceDateTime = QDateTime::fromString(lineList, "MM/dd/yyyy hh:mm AP"); And again it tells you that the type of the first parameter is QStringList. As the function name implies it wants a QString instead. So, you need to take one element out of the string list to pass to the function. Please have a careful look at the error messages because these ones you are posting are really easy to read and see what's wrong. C++ is a strongly typed language. Learn to use this power to your advantage. The compiler exactly tells you when you are using the wrong type. And it is a lot better to have this information at compile time than to have to figure this out at runtime.