Qt is a cross-platform application and UI framework for developers using C++ or QML, a CSS & JavaScript like-language. (Also use the [c++] tag for C++ code.)
5
votes
1answer
36 views
Qt/C++ tool to prepare custom screenshots for uploading to Steam Cloud
Recently I've released my first ever Qt application, and would be glad if someone will look into it and tell me if there are some flagrant anti-patterns and likes.
I must confess, that I never read ...
1
vote
1answer
43 views
QSlider direct jump on click
By default, QSlider move his thumbtrack by a value belonging to the singleStep() prop on mouse click. To make thumbtrack jump directly at the mouse click point, we need to create a new class inherited ...
4
votes
1answer
64 views
Reimplemented QAbstractTableModel::setData
I have subclassed Qt QAbstractTableModel with QJsonDocument as data source which I have reimplemented the ...
0
votes
0answers
12 views
Qt model and Qml pages/controls binding to that model
We're currently learning Qt Quick (with Qt 5.3 at the moment). QML and Qt are not very familiar to me. I'm looking for feedback on the code below.
It's not complete code. Ports.h and Ports.cpp are ...
1
vote
1answer
81 views
3
votes
0answers
409 views
Insert new row to a QTableView by double-clicking the last row
Recently I was experimenting with QTableViews and I wanted to create something where I can add a new row to a table without having any additional button/menu item outside the table. I achieved this by ...
4
votes
0answers
107 views
MVC and Subject-Observer pattern in C++ & QT
I am trying to implement the MVC pattern in C++ & QT, similar to the question here:
Other MVC Questions
The program has 2 line edits:
mHexLineEdit
mDecLineEdit
3 buttons
...
1
vote
1answer
66 views
Setting and showing an image file on a QGraphicsView
This code sets and shows an image file on a QGraphicsView.
I'm interested in seeing how to improve readability and reduce redundancy.
...
3
votes
1answer
60 views
Image downloader class
I'm a novice regarding both C++ and Qt. This class is used in my project to get an image from a web service.
If a new call to StartDownload is made before the ...
3
votes
2answers
63 views
0
votes
2answers
824 views
Replacing certain characters in a QString
This question is kinda similar to mine. However, I am using C++ with Qt instead of C#.
How would I efficiently and easily remove all accents and special characters like !"§$%&/()=? etc. from a <...
5
votes
1answer
56 views
Accessing information from a parent class
My MainWindow popups a SettingsDialog. The setting dialog need to hide certain fields if the connected device is certain type.
<...
2
votes
1answer
291 views
MyTimer based on QTimer
I needed a timer that fires in intervals for a given duration when e.g. a button is pressed. The button can be pressed several times thus I thought it would be easiest to create a new timer for each ...
1
vote
0answers
54 views
PyQt5 validator for decimal numbers (V2)
This class is similar to QDoubleValidator, but it improves slightly on the editing comfort.
Are there any corner- or special cases of inputs I didn't consider, which would lead to bad behaviour?
Is ...
3
votes
1answer
70 views
PyQt5 validator for decimal numbers
This class is similar to QDoubleValidator, but it improves slightly on the editing comfort. The comments mention "comma" but it's actually the decimal point of your locale (comma for me).
...
5
votes
2answers
797 views
Mean, Median and Mode of a QVector
I would like some help condensing this code down to size. I am trying to utilize Qt's container classes as efficiently as possible. I do not believe this code reflects my objective.
...
2
votes
0answers
45 views
Function that converts Georef string to QPointF
I have a list of files that represent map tiles where the filename encodes the geographic location of the tiles. It is the Georef system. You'll find more resources via google.
Questions:
How can I ...
6
votes
2answers
205 views
Reading an SSH config file for an IP
I wrote this class which reads an SSH config file and checks whether an IP exists. If the IP does not exist, the class adds a block for that IP address.
Header file:
...
3
votes
1answer
93 views
Object destruction in Qt dialog
I am new to Qt and am trying to understand object destruction and where I need to explicitly destroy objects using delete.
...
3
votes
1answer
383 views
Using QSqlQuery::bindValue() for variable number of placeholders
I am familiar with the simple use of QSqlQuery::prepare() and QSqlQuery::bindValue() as in:
...
3
votes
2answers
2k views
Currency converter using MVC pattern in C++ & QT
While understanding the MVC pattern, I came across this particular article. I thought to implement it using the C++/QT library.
The intent over here is to implement/use MVC concepts in correct way. ...
3
votes
1answer
71 views
Representing vehicles and their components
I am working on a project that needs to represent different kinds of vehicles, components of these vehicles and actual parts of the components.
So far I have this code:
...
2
votes
1answer
140 views
Writing binary data to file in Linux
I'm trying to learn C++ and I would interested in how I could write better code. The code should be independent of the architecture it is running on. What I want to do is writing some binary data to /...
1
vote
1answer
744 views
Corrects the encoding of a CSV file in Qt
I'm hoping for a little bit of a code review to ensure I am doing UTF-8 right. I am developing a "csv_fixer" that allows a user to select the encoding of the file so we can correctly handle encoding ...
6
votes
2answers
281 views
Qt Custom Scatterplot
I have created a custom scatterplot in Qt and am wondering if there is a more efficient way to do it. Here is a sketch of the problem:
The layout of the plotting area consists of a rectangular ...
4
votes
1answer
684 views
Dynamically adding QLineEdits and then copy text from them to vector in right order
Here is how it looks at the beginning:
And after I can add random counts of line edits:
Or delete them:
The main purpose is the possibility to add or delete ...
10
votes
1answer
154 views
5
votes
1answer
307 views
18
votes
1answer
3k views
Ultimate Tic-Tac-Toe with AI and GUI
During my hiatus, I decided to revisit some of the Tic-Tac-Toe questions here. I created a simple Tic-Tac-Toe GUI game, and then thought, might as well do the Ultimate Tic-Tac-Toe challenge.
I am ...
3
votes
1answer
722 views
Multi-user server connection handling
I'm writing a program and I have a server that needs to be able to handle multiple client connections at once doing many different things.
I'm using the Qt library, so I handle new connections like ...
5
votes
2answers
160 views
Scoring matches of a game - reducing duplicated code
I'm writing a small application to score matches of a game. (There are two "teams" on each "alliance", and two alliances play each other in a match.) I have a "logic" class that handles the values of ...
8
votes
3answers
4k views
Travelling Salesman in Qt
I am writing a recursive function based on the Travelling Salesman Problem.
Is this a correct way of doing things, or am I creating memory leaks?
Prerequisites are:
a two dimensional matrix ...
1
vote
1answer
501 views
Optimization of a Qt QByteArray conversion
I wrote a function to convert a hexadecimal string representation (like 0x00) of some binary data to the data itself.
How can I improve this code?
...
1
vote
1answer
797 views
Conversion between QString and BSTR
I'm currently working on a Qt project writing Excel files through a third party DLL.
As the third party DLL has a COM interface, I have to do lots of conversions between QString and BSTR...
I wrote ...
5
votes
2answers
1k views
User controlled rotation with arcBall
I am trying to visualize a pointcloud centered around the origin. I also want to have a user controlled rotation for which I found the arcball.
rMat is the model ...
1
vote
1answer
275 views
Text-Based Simulator with many commands
The following is an excerpt of a mostly text-based simulator of the iRobot Roomba robot vacuum. I made a class called Roomba that handles everything the roomba does. For those familiar with QT; There ...
5
votes
1answer
405 views
Interface for a tree node in Qt
I have the following C++ interface (in Qt) for a tree node, inspired somewhat by Valve's implementation of a culling octree:
...
7
votes
1answer
4k views
Deleting pointers in Qt5
I am relatively new to the Qt framework and I was wondering if I should delete pointers in my program. I know that, in C++, if memory is not return it could lead to memory leak, but I am not sure if ...
6
votes
1answer
957 views
OpenGL object wrapped in a Qt Widget
I have this object wrapper class, which I will use to implement my Qt OpenGL scene. It is working, but I am looking for a way to:
Improve the API.
Remove extra OpenGL calls.
Optimize it.
I know ...
5
votes
1answer
890 views
QPlainTextEdit subclass function to indent lines in selection
I am, primarily for learning purposes, working on creating an editor component in C++ with Qt. As a first step, to begin getting familiar with editing a document via ...
8
votes
1answer
3k views
QNetworkReply network reply timeout helper
Since Qt still does not support to set timeouts on QNetworkRequest objects, I wrote this little wrapper class:
...
6
votes
1answer
369 views
1 producer, n consumer with QThread
I am new to C++ and to threading, so I'm sorry if my code is bad. I'm here to get it better and to learn.
Any kind of advice (both on C++ style, on Qt usage, or on threading handling) is welcome. ...
8
votes
1answer
3k views
Thread pausing/resuming/canceling with Qt
I have written this code to be able to suspend (or to cancel) a worker executed in a separate thread in Qt.
To do it, I have used an instance QWaitCondition and <...
4
votes
2answers
3k views
Yet another JSON parser and serializer for Qt, but with additional features
I wrote QJson, a utility class in/for Qt, I need you to take a look at. It is both a JSON parser and serializer, but with extended functionality (going beyond the ...
13
votes
0answers
3k views
QJsonView: A QWidget-based json explorer for Qt
I'm developing applications using Qt which highly make usage of the JSON language to communicate, store and load data of different types. I often need a simple viewer similar to the Firebug JSON ...
1
vote
1answer
239 views
Driver-layer from top-level app to hardware
I'm attempting to implement driver-layer (shared library) from top-level app to hardware.
In the first, I extracted interface functions, which further will be called from "extern "C" SHARED" wrappers ...
4
votes
1answer
2k views
Qt foreach-like alternative to iterate over value AND key of an associative container
The Qt documentation recommend an iterator-based solution to iterate over an associative container like QMap and QHash, and I always wondered if there really isn't a (nice) solution using a ...
2
votes
1answer
768 views
Resource locker in Qt
The idea is to lock resources in C# or Java using Qt:
lock(obj){/*process with locked obj*/}`
Now I see the problem with deleting ...