Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 457.9k Posts
  • Convert QByteArray to vector<uint8_t>

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    JoeCFDJ
    @JonB nice solution. Is std::vector<uint8_t> c( bytes.begin(), bytes.end() ) more C++ style-ish?;
  • Tag - Length - Value parse in qt

    Solved
    6
    0 Votes
    6 Posts
    470 Views
    S
    JonB is completely right. You initialize the QByteArray with "numerical garbage" and so the de-serialization fails. Details: If you initialize QByteArray with a const char * you will get the ASCII codes as values. A "0" will thus yield a value of 48, which is definitely not a valid enum TLV_TYPE. And even if it would be a numerical zero, it would decode to TLV_TYPE::UNDEFINED, which doesn't sound reasonable. Please use data which was generated from a serialization.
  • "Sticky option" for widget based window

    Unsolved
    1
    0 Votes
    1 Posts
    195 Views
    No one has replied
  • QSlider connect and C++ lambda ?

    Unsolved
    5
    0 Votes
    5 Posts
    835 Views
    S
    @Chris-Kawa said in QSlider connect and C++ lambda ?: Just a note here. Since you're not using this in the lambda you don't need to capture it. Just an additional note. If you are actually using this inside the lambda, use this as context object (third parameter, right before the lambda) inside the connect(). If it's another object, use that object instead. Once the context object is deleted it will automatically disconnect the lambda. You'll get some strange behavior if you are calling a slot on a deleted object. In your specific example a context object is not needed.
  • This topic is deleted!

    Unsolved
    26
    0 Votes
    26 Posts
    97 Views
  • MySQL&#x2F;MariaDB connector driver building Qt 6 Windows 10

    25
    0 Votes
    25 Posts
    4k Views
    P
    @paokaras98 said in MySQL&#x2F;MariaDB connector driver building Qt 6 Windows 10: Ok I got your point. However, suppose I have a customer to sell my software and this customer does not want to mess up with installations. He wants only an all-in-one installer to install the app and the dependencies(in my case the dbms server). So the dbms server .msi should be somehow included to my final installer and executed... am I right?. Thank your for your clarification. I will make my research now
  • How to change shortcuts?

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    jsulmJ
    @icebergenergy What exactly is your question? Just select what you want to change and enter the key sequence in "Key sequence". It is even explained in the link you posted. If something is not clear then please ask a clear question.
  • Sniffing broadcast udp socket on specific MAC address

    Unsolved network udp
    3
    0 Votes
    3 Posts
    689 Views
    C
    If something else sends a UDP datagram to the sub-net IP broadcast address (e.g. 192.168.1.255 on IP subnet 192.168.1.0/24) then any device connected to, and configured for, that IP sub-net should receive the datagram. You need to know the port that the UDP datagram was sent to also. Assuming your listeneing device is connected to the relevant physical network and has suitable IP address/subnet mask, then all you should need is to QUdpSocket::bind() to your IP and port.
  • QSvgWidget load svg Datei, "libpng warning: iCCP: known incorrect sRGB profile"

    Unsolved
    2
    0 Votes
    2 Posts
    610 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
    958 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
    701 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
    484 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
    426 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
    389 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
    502 Views
    B
    @Chris-Kawa Thanks.