Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • How to convert QJsonObject to QByteArray?

    Solved
    2
    0 Votes
    2 Posts
    3k Views
    jsulmJ
    @HeerokNewbie https://doc.qt.io/qt-5/qjsondocument.html#setObject https://doc.qt.io/qt-5/qjsondocument.html#toJson
  • How to read Japanese and Korean characters?

    Solved
    10
    1 Votes
    10 Posts
    816 Views
    jsulmJ
    @harish__rajora said in How to read Japanese and Korean characters?: It takes char * as input And what encoding does it expect? ASCII, UTF16, UTF8, ...? For Japanese you have to use Unicode and that can't be represented in normal C ASCII string (char*).
  • Designate Header as x-axis in tableview model

    Unsolved
    1
    0 Votes
    1 Posts
    178 Views
    No one has replied
  • QSortFilterProxyModel mapToSource causes segfault

    Unsolved
    2
    0 Votes
    2 Posts
    568 Views
    ocgltdO
    @ocgltd I found StackOverFlow post which suggests using 'index' instead of 'createIndex' in my function. And that works. Can someone explain why? What's the difference?
  • QAbstractItemDelegate.paint seems to be called with wrong option.rect

    Unsolved
    4
    0 Votes
    4 Posts
    386 Views
    H
    @SGaist said in QAbstractItemDelegate.paint seems to be called with wrong option.rect: Just thinking quickly, shouldn't you adjust the rect position based on the index row ? In this case, images can have different aspect ratios, so I'd need ratio of each image before current one to calculate where to paint it. (It can be done, but seems to be going against design of delegate.) More importantly, values of rect seem to still affect how mouse events are handled, so even if I'd adjust paintings, selecting element's would work on offsets defined by rect and click event's wouldn't work properly. By the way, I think you should use QStyledItemDelegate as base class for your delegate since it's the default class used for the item views. Thanks for the tip!
  • Howto substring using QString

    Solved
    4
    0 Votes
    4 Posts
    8k Views
    P
    Thanks. That helped
  • How to open console window via QProcess?

    Unsolved
    8
    0 Votes
    8 Posts
    5k Views
    M
    Wanted to do something similar and found this while checking if QProcess could handle it conveniently (it can't, as seen above). Just use std::system. Doing it with QProcess just makes extra work. E.g. for the OP: #include <cstdlib> std::system("adb -s device shell"); If you want to just open a command shell, the command depends on the platform but it'd be something like: std::system("cmd"); // windows std::system("/bin/bash"); // linux, maybe osx? // etc... For that Python example above: std::system("\"C:\\Program Files\\Inkscape\\python.exe\""); // or if necessary: std::system("cmd /K \"C:\\Program Files\\Inkscape\\python.exe\""); // or if python is in the path, just: std::system("python"); PS This whole thread is a bit silly. The OP didn't want to open a shell on a phone, and there's definitely good reasons to start adb in a console window (it's a console-based interactive shell for debugging an attached Android device). The OP wanted to start it in a console window so they could continue to use it in said console window after starting it.
  • Apply rubberband in more than one data series

    Unsolved rubber band qcandlestick lineseriechart
    3
    0 Votes
    3 Posts
    730 Views
    M
    Hi SGaist , thanks for your welcome... I'm drawing these lines like this chartview=QChartView(self.__candlechart) chartview.setRubberBand(QChartView.HorizontalRubberBand) chartview.setRenderHint(QPainter.Antialiasing) lineserie1=QLineSeries() for i in self.times: lineserie1.append(QPointF(i,random.random())) pen = lineserie1.pen() pen.setWidth(3) pen.setBrush(QBrush(QColor(255,0,0))) lineserie1.setPen(pen) lineserie2=QLineSeries() for i in self.times: lineserie2.append(QPointF(i,random.random())) pen = lineserie2.pen() pen.setWidth(3) pen.setBrush(QBrush(QColor(0,0,255))) lineserie2.setPen(pen) self.__candlechart.addSeries(lineserie1) self.__candlechart.addSeries(lineserie2) If I change the order (I mean add the lines before set rubber band option I got the same result. Thanks!
  • How in Qt6 use c++ signal with argument in qml?

    Solved
    6
    0 Votes
    6 Posts
    481 Views
    SGaistS
    So my suggestion was correct ?
  • QTest Error

    Solved
    5
    0 Votes
    5 Posts
    553 Views
    I
    @SGaist Problem is solved after I added Q_DECLARE_METATYPE for my custom structures. Thank you
  • What is required to debug into qt-internals with mingw on windows 10?

    Unsolved debug debugger
    1
    0 Votes
    1 Posts
    154 Views
    No one has replied
  • QChart: How to draw text inside chart (C++)

    Unsolved
    2
    0 Votes
    2 Posts
    505 Views
    M
    Hi Rifky , I know that I' m not answering exactly to your question , but maybe this link will help you, or inspire you. The graph shown another ways to show info https://doc.qt.io/qt-5/qtcharts-donutbreakdown-example.html Bye!
  • can't find linker symbol for virtual table for `MainWindow' value

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    M
    You can also start fresh and reconfigure your project. With QtCreator closed; delete the build folder(s) and the CMakeLists.txt.user file in your project folder. Then open the project again in QtCreator.
  • How to modify the frequency of QNetworkReply::downloadProgress(..) signal ?

    Solved
    2
    0 Votes
    2 Posts
    213 Views
    Christian EhrlicherC
    It's hard-coded to 100ms in qnetworkreply.cpp.
  • Problem not knowing " QT += gui-private " in Qt

    Solved
    2
    0 Votes
    2 Posts
    867 Views
    S
    I install " libxkbcommon-dev " and fixed error
  • Get transparency of qt theme

    Unsolved
    1
    0 Votes
    1 Posts
    171 Views
    No one has replied
  • Sorting with MVC and database. Row number confusion - conceptual question

    Solved
    2
    0 Votes
    2 Posts
    220 Views
    JonBJ
    @ocgltd said in Sorting with MVC and database. Row number confusion - conceptual question: Does the QSFPM translate view row numbers to QAIM row numbers as read from the DB? Yes. And note that QSortFilterProxyModel has a bunch of map...() methods for converting QModelIndexes between it and the source model when these are needed. Or I have to have the QAIM perform SQL Selects using a different 'sort by' order based on the View's sort order? Noooo :) And note that any model could be used by multiple views, each with different sorting/filtering, so the model never needs to do anything about, or know anything about, what views might do with its data.
  • QMediaPlayer works with QVideoWidget, but not with QAbtractVideoSurface

    Solved
    2
    0 Votes
    2 Posts
    182 Views
    KutyusK
    Resolved the problem: supportedpixelformat method need more formats: return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB32 << QVideoFrame::Format_ARGB32 << QVideoFrame::Format_ARGB32_Premultiplied << QVideoFrame::Format_RGB565 << QVideoFrame::Format_RGB555;
  • Selected QLabel?

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    JonBJ
    @apalomer said in Selected QLabel?: You have to imagine that label1 lives in two different UI files that end up composed in the same GUI Then you need to use the UI file/class somewhere in the selector to distinguish. (To be clear: you can use your own class names in the selector, not just Qt inbuilt ones like QFrame or QLabel.) Anyway, I have tried the descendant selector but I would like to have the name of the ascendant. Something like this: The available facilities are in the reference I gave, and that does not include "ascendant" direction, only "descendent", as per CSS too. I guess I will have to change the names at the end.... I don't see why. Presumably the different .ui's classes are different, and that should be usable in the selector. There is also a supplementary way of distinguishing your labels which may suit. In that same reference page see Property Selector QPushButton[flat="false"] and https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-using-dynamic-properties. You can add your own dynamic properties even in Designer on a widget, there is some "add property plus-button" on the properties on any widget.
  • Why QApplication::processEvents(QEventLoop::AllEvents, 20);?

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    F
    @JonB Thank you for clarification