Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • StyleSheet for custom widget inherited from `QSlider`

    Unsolved
    1
    0 Votes
    1 Posts
    259 Views
    No one has replied
  • Where is the Qt Visual studio 2022 Extension?

    Unsolved
    5
    0 Votes
    5 Posts
    684 Views
    V
    @SGaist Thanks !
  • Calling a QT Button (C++) From the External Python Script

    Unsolved
    2
    0 Votes
    2 Posts
    168 Views
    SGaistS
    Hi and welcome to devnet, Qt is a C++ framework. From what you wrote your QtQuick GUI calls a C++ backend so the question is: do you really need the GUI to run when using your Python script ? You also have the option of implementing your code with PySide2/6 or PyQt5/6 if your main logic lies in Python.
  • How to use touchevent in QquickWidget on QMenu

    Unsolved
    4
    0 Votes
    4 Posts
    377 Views
    raven-worxR
    @Qt-Jo-Ha you might also need to set it on the QMenu itself
  • Read JSON from LocalHost and Dynamically fill QTableWidget.

    Solved
    9
    0 Votes
    9 Posts
    797 Views
    SGaistS
    Why a static variable ?
  • i need buffer for serial communication

    Unsolved
    3
    0 Votes
    3 Posts
    250 Views
    mrjjM
    Hi I don't know how to think as I've never used a buffer before In your Mainwindow / where serialport lives, add in the .h / class QByteArray data; // the buffer then in the read slot void MainWindow::readData() { data.append(m_serial->readAll( ) ); if (data.size() == 10 ) { // do processing data.clear(); } }
  • Image Gestures Example Windows / Laptops Trackpad

    Unsolved
    1
    0 Votes
    1 Posts
    164 Views
    No one has replied
  • How to convert QTCreator Linux project pro file to C/C++ library?

    Unsolved
    4
    0 Votes
    4 Posts
    343 Views
    artwawA
    @AnneRanch manual in that respect can be confusing as it tends to have all the options for MSVC and Windows. For gcc/clang not really needed. I quite often export parts of my code as a library if said code is/can be useful across the various tools I create, I do remember being confused about how to write it.
  • 0 Votes
    19 Posts
    4k Views
    D
    The QTBluetooth Central API is not supported on any platform. see the first table in Qt Bluetooth
  • Text of styled font is clipped

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    D
    @AhmedAlshawi said in Text of styled font is clipped: I have come across a similar issue but affecting the text on the bottom (see the p's and g's), and I can't seem to solve. Anyone have any idea? Don't change fontsize by stylesheet. Instead use QWidget::setFont() like this: tw = new QTabWidget(); tw->setFont(QFont(tw->font().family(), 16)); looks like: [image: 99d41259-2ceb-404b-94cf-1d54c187656e.jpg] You see - no vertical clipping :) I don't use stylesheets for font-changes at all. QTabBar was the first widget, I had to :( @raven-worx said in Text of styled font is clipped: he cleaner solution would be to intercept the size of the tab via a proxy style (but wont probably not work with a stylesheet style) or subclassing QTabBar and reimplement initStyleOption() (virtual since Qt6 only) Well, that may be true. When I digged into the sources, I thought I'd start to extend QSize QTabBar::tabSizeHint(int index) const ... ... but I decided not to spend too much time into patching Qt. Especially as the workaround costs nothing and works like charming :)
  • Invalid parameter passed to c runtime

    Unsolved
    16
    0 Votes
    16 Posts
    9k Views
    PadawanP
    Haha, Funny thread @J-Hilk thanks for the explanation you gave up there about debugging. It taught me something new
  • QXmlStreamReader throws error when reading a sub element

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    A
    As expected readElementText() cannot read "complete" (tag and content) child elements. However it is possible to ignore child element or to get only their content by using QXmlStreamReader::ReadElementTextBehaviour enum as parameter. Unfortunately this does not provide a straight forward solution to my problem so I had to found a workaround. For example I want to get all the child elements of the project tag (and ignore all grandchildren): while (!xmlReader.atEnd()) { QXmlStreamReader::TokenType token = xmlReader.readNext(); qDebug() << "Next token:" << token << xmlReader.tokenString() << "- at line:" << xmlReader.lineNumber() << "- name:" << xmlReader.name(); if(token == QXmlStreamReader::StartElement && xmlReader.name() == QString("project")) { xmlReader.readNext(); while(xmlReader.name() != QString("project")) { xmlReader.readNextStartElement(); qDebug() << "- tag:" << xmlReader.name() << "- content:" << xmlReader.readElementText(QXmlStreamReader::SkipChildElements); } } } Although it's working it is not very elegant and might not be really reusable (e.g. to get the dependencies in a pom.xml file). Thank you for reading. Have a nice day.
  • A concurrent function run problem.

    Solved
    8
    0 Votes
    8 Posts
    532 Views
    J
    @jsulm Thank you. Now it works good. No GUI blocking.
  • QquickWidget touch event not working under some circumstances

    Unsolved
    1
    0 Votes
    1 Posts
    136 Views
    No one has replied
  • How do you define shape for pie slice and animate?

    Unsolved
    3
    0 Votes
    3 Posts
    254 Views
    D
    Drawing direction and radian were the problem. With these: #define whats16 16 Slice::Slice(float start, float sweep, QColor color, QGraphicsItem* parent) : QGraphicsItem(parent), m_start(start), m_sweep(sweep), m_color(color){ m_realColor = color; m_rect = QRectF(0,0,200,200); m_path = QPainterPath(QPointF(m_rect.width() / 2, m_rect.height() / 2)); m_path.arcTo(m_rect, -m_start, -m_sweep); m_path.closeSubpath(); dx = 10 * cos((m_start + m_sweep / 2) * M_PI / 180); dy = 10 * sin((m_start + m_sweep / 2) * M_PI / 180); setAcceptHoverEvents(true); } QRectF Slice::boundingRect() const { return m_rect; } QPainterPath Slice::shape() const { return m_path;} void Slice::hoverEnterEvent(QGraphicsSceneHoverEvent*){ m_color = Qt::gray; moveBy(dx, dy); } void Slice::hoverLeaveEvent(QGraphicsSceneHoverEvent*){ m_color = m_realColor; moveBy(-dx, -dy); } void Slice::paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*){ painter->setRenderHint(QPainter::Antialiasing); painter->setPen(Qt::white); painter->setBrush(m_color); painter->drawPie(m_rect, whats16 * -m_start, whats16 * -m_sweep); } Now, slice moves perfectly: [image: cb199f19-a0d1-4d4c-acfc-8eb4bb342d51.gif] BUT the whole pie moves for a while (5 times as I start hovering over different slices). Why does it move?
  • App crashes due to QNetworkReply

    Unsolved
    19
    0 Votes
    19 Posts
    2k Views
    PadawanP
    @Pl45m4 It always crashes if the API Key Request process happens
  • popup modal dialog does not have focus on touch screen

    Solved
    17
    0 Votes
    17 Posts
    3k Views
    X
    @JoeCFD , @swansorter, I finally figured out what whas happening in my case. Since my touch screen is a capacitive one, I had to create my qdialog on mousereleaseevent, instead of on mousepressevent.
  • AttributeError: 'MainWindow' object has no attribute 'Region_comboBox'

    Unsolved
    4
    0 Votes
    4 Posts
    4k Views
    L
    @eyllanesc Thanks a lot it worked perfectly
  • how to convert between QPixmap/QImage and Xlib Pixmap?

    Unsolved
    3
    0 Votes
    3 Posts
    540 Views
    MozzieM
    @SGaist said in how to convert between QPixmap/QImage and Xlib Pixmap?: qt_xcb_pixmapFromXPixmap Thank you very much.
  • Qt with opencv and gstreamer not working

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    SGaistS
    @ShahShaj said in Qt with opencv and gstreamer not working: Instead of using QtMultimedia, qmlglsink will be a better option? Worth a try indeed.