trying to load a column that contains an image in tableview.
Hi a newbie here, am working on a school assignment am trying to find a way to load the images inside the table view column
here is my code: https://ghostbin.co/paste/6zuvv/raw
https://preview.redd.it/623j5yj7pca61.png?width=677&format=png&auto=webp&s=2bc91fcc35c8550b048f437c4806f6020afd8142
the images are saved as blob in the database, any help is appreciated.
https://redd.it/ktwm5t
@qt_reddit
How to check if an item is on the StackView?
I am testing out a KDE framework, Kirigami which is based on Qt Quick Controls 2 and is structured around QML's stack view. I have a button in a globally accessible bar that pushes a page with a to-do list. I want to make the button check if the page is already on the page stack and push that page if it is not.
​
I looked online and found https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html#currentItem-prop
​
Relevent KDE API doc: https://api.kde.org/frameworks-api/frameworks-apidocs/frameworks/kirigami/html/classorg\_1\_1kde\_1\_1kirigami\_1\_1AbstractApplicationWindow.html#a95bc61a3c6058c540bd32379a8e28d49
​
Here is a section of the global drawer
Kirigami.GlobalDrawer {
id: globalDrawer
title: "Global Drawer"
titleIcon: "qrc:/Images/Kde-Logo-Blue.png"
bannerImageSource: "qrc:/Images/Plasma-Logo-Colorful.png"
bannerVisible: !globalDrawer.collapsible
modal: false
collapsible: true
showHeaderWhenCollapsed: true
// ...
Kirigami.Action {
text: "To Do"
iconName: "korg-todo"
onTriggered: {
console.log("test");
console.log(root.pageStack.currentItem.id.toString());
if (root.pageStack.currentItem.id != "toDoPage") {
root.pageStack.push(toDoPage);
}
}
}
// ...
}
Here is the main.qml
import QtQuick 2.13
import QtQuick.Layouts 1.13
import QtQuick.Controls 2.13 as QQC2
import org.kde.kirigami 2.11 as Kirigami
Kirigami.ApplicationWindow {
id: root
Component{
id: aboutPage
AboutPage{}
}
Component{
id:mainPage
MainPage{}
}
Component{
id: alexPage
AlexPage{}
}
Component{
id: listPage
ListPage{}
}
Component{
id: toDoPage
ToDoPage{}
}
wideScreen: true
reachableMode: false
globalDrawer: GlobalDrawer{}
contextDrawer: Kirigami.ContextDrawer {
id: contextDrawer
}
pageStack.initialPage: mainPage
}
All attempts have been futile. I hate the fact that the doc literally has just one sentence on this function.
https://redd.it/ksrs88
@qt_reddit
I need an example for MVVM architecture, where the view is in QML and MODEL, VIEWMODEL in CPP. I want to understand how it works.
I am trying to understand MVVM architecture and I need a good example code so that I have a clear understanding of how the architecture actually works . Any kind of help will be greatly appreciated, Thank you in advance.
https://redd.it/ksek5n
@qt_reddit
QTcpSocket connects to Python server, but can't read any bytes
I'm trying to make a client-server app, with the server written in Python with asyncio and the client written in C++. I want to use blocking networking in a separate thread, but I'm just testing things out for now. I can get my C++ client to connect to the Python server but it won't read any bytes from the server before timing out. I followed the [blocking fortune example from Qt](https://doc.qt.io/qt-5/qtnetwork-blockingfortuneclient-example.html).
​
C++ (at the moment this is just in the constructor of my app's main window):
QTcpSocket sock;
const int Timeout = 5 * 1000;
sock.connectToHost("127.0.0.1", 20000);
if (!sock.waitForConnected(Timeout)) {
std::cerr << "Connection attempt timed out" << std::endl;
return;
}
QDataStream in(&sock);
in.setVersion(QDataStream::Qt_5_15);
QString msg;
do {
if (!sock.waitForReadyRead(Timeout)) {
std::cerr << sock.errorString().toStdString() << std::endl;
return;
}
in.startTransaction();
in >> msg;
} while (!in.commitTransaction());
std::cout << msg.toStdString() << std::endl;
sock.disconnectFromHost();
Python:
import asyncio
import struct
async def handle(reader, writer):
print('connected')
writer.write("yeet".encode())
print('sent')
loop = asyncio.get_event_loop()
coro = asyncio.start_server(handle, "127.0.0.1", 20000)
server = loop.run_until_complete(coro)
print('running')
loop.run_forever()
The error string reads "Network operation timed out" (in the do-while loop). Interestingly, this works when following the non-blocking model, but that won't work for my use case. Also, I verified the Python server with netcat so I'm fairly certain the problem is with QTcpSocket. Any idea what could be causing this?
https://redd.it/kr93tq
@qt_reddit
Can I update QT without breaking a software I compiled using QT?
I had to download and install an older version of QT to compile a software from here. Is there anyway the compiled software would have problems functioning if I now updated QT to another version?
I am using Ubuntu 18.04 and currently have QT 15.13 installed. I don't feel like there'd be any problem but want to be absolutely sure that the software I compiled using QT does not rely on the QT installed on my system.
https://redd.it/kr6zcs
@qt_reddit
Can't connect to database in release mode meanwhile in the debug mode everything runs smoothly, does anyone know what's happening ?
https://redd.it/kqrykk
@qt_reddit
Qt TensorFlow Lite example
https://github.com/IvanSafonov/qt-tf-lite-example
https://redd.it/kq9v7l
@qt_reddit
SSL handshake fails when running Qt installer
I'm trying to install the latest Qt version using the online installer. Every time i run it i get an SSL handshake failed error: https://i.imgur.com/4JQxZ98.png
This also happens if i run the maintenance tool in the current Qt5 installation i have, but only if i try to filter the list of available components.
Is there something wrong with the website it's trying to connect to, or is this a problem on my end?
https://redd.it/kq9qx2
@qt_reddit
Want is the equivalent of QAudioOutput in QT 6
I cannot seem to find it, I assume it’s deprecated and a new class is available?
https://redd.it/kpsvwj
@qt_reddit
GitQlient 1.3.0 RC (Release Candidate)
Hi all!
After several months of working on the new release I'm getting close to be ready for the 1.3.0 release of GitQlient. The features have been frozen and now it's only a matter of polishing the last details.
I added a list of changes for this version but I'd really like to get feedback on the UI/UX part since I'm don't consider myself an expert on that matter. I'm also how has created it and runs it the whole time so I'll be bias about the behaviour and what for me seems the normal thing to do, it's probably quite different for the rest of the people.
You can download the AppImage or the DMG (not tested on OSX) from here.
Feel free to try it and give me as much constructive feedback as possible!
https://redd.it/kpm9fj
@qt_reddit
Question on Qt4 installation in Ubuntu 20.04 (libsmokeqt4-dev)
Hi everyone ~
I'm installing a third party software application which requires Qt4. I have added the necessary repository to pull from sudo add-apt-repository ppa:rock-core/qt4
. There is one package that this third party installer is trying to locate which is called libsmokeqt4-dev
. The installer essentially yields the error E: Unable to locate package libsmokeqt4-dev
.
A sudo apt search libsmokeqt4
yields nothing and googling this does provide a few helpful links such as to __to download the package__.
I have not downloaded the deb package mainly because its indicating Ubuntu 18.04 not Ubuntu 20.04. Would someone be able to advise me on how to install this package in a Ubuntu 20.04 environment? Thank you for your time.
~ S
https://redd.it/kp4zmy
@qt_reddit
Advice to develop video conferencing app.
Hello everyone! I'm a masters student in electronics engineering. Due to recent pandemic my high school in my town is unable to teach students properly. They cannot afford apps like zoom or google meet. I want to develop a simple,reliable and stable end to end video conferencing (for 40 students per class) app for low cost. Please suggest me accordingly.. Before that note the following:
1)I have experience in developing embedded systems
2) coding exp. In c,c++,python.
Im also willing to learn new langugaes or frameworks to complete the project. So dont hesitate to advice irrelevant things to me.
Thanks in advance.
https://redd.it/kos1wd
@qt_reddit
Someone help me please, all I want to do is to send a get request to an api and parse the json reply! the code is working fine, there is a problem with openssl, I tried all the solutions in the internet and it is not working yet.
​
https://preview.redd.it/y8hr95aqkp861.png?width=845&format=png&auto=webp&s=379fd760e505b6181601119014475474778520ca
https://redd.it/koa1p4
@qt_reddit
How do I properly install Qt5 onto fedora?
I just want the basic tools such as Designer, Creator, Assistant, and Linguist.
https://redd.it/knk21q
@qt_reddit
Development Tools/Services
Slightly off-topic post, but related in terms of tools used alongside Qt for developing applications.
Thinking that maybe people can share tools/libraries that they've found which have proven invaluable for software development.
I'll start with a few of my must-have tools:
​
Affinity Designer & Affinity Photo (I use on macOS, Windows and iPad) for designing assets for use in my applications.
IcoFX (Windows), I use this for creating .ico and .icns files, I haven't found any tool that comes anywhere what this tool offers.
CMake (macOS, Windows, Linux) - Don't know how I lived without this, so powerful.
Ninja (Windows) - I only use it under windows, but it speeds up builds considerably.
CLion (macOS, Windows, Linux) - My IDE for software development, I no longer use Qt Creator for my personal projects.
Certum - They provide OSS code signing certs, I have a USB stick which is used to sign, the initial cost of the hardware is circa \~100 euros (if I remember correctly), but subsequent renewals of the cert are much cheaper.
Deleaker - Windows-based memory leak analyser,
Noun Project - Website that has lots of icons that can serve as a base for icons in your applications.
https://redd.it/klv2yq
@qt_reddit
How can I pass a property to a child so it can be updated in the child (not using signals)
Edit: I messed the title up, it's not about children but about elements in a QML view
I don't think what I am trying to accomplish can be done with simple signals. I'm trying to create a settings page with a ListView where each entry has a name and a Loader for a component that is contextual depending on the settings item (like a button for settings that are clicked like reboot, a switch for selecting between two things, etc)
I'm at a loss on how to do this since the variable that is being manipulated is dependent on the list.
I'm sure I didn't explain it well, so here is some code representing what I'm trying to do. In this case, I want to update the value of each of the testBool values. This code doesn't work, but should show the idea.
property bool testBool1: false
property bool testBool2: true
property bool testBool3: false
property bool testBool4: true
ListView {
id: listViewId
height: 500; width: 500
delegate: Item {
height: 30
width: 500
Row {
Label {
text: model.title
}
Switch {
checked: model.val
onCheckedChanged: {
if(model.val !== checked) {
model.val = checked
}
console.log("New Value:" + model.val)
}
}
}
}
model: ListModel {
Component.onCompleted: {
append({ title: "Value 1", val: testBool1 })
append({ title: "Value 2", val: testBool2 })
append({ title: "Value 3", val: testBool3 })
append({ title: "Value 4", val: testBool4 })
}
}
}
This is what I'm using to display the current values of the variables:
Column {
anchors.top: listViewId.bottom
height: 500; width: 500
Label {
text: "testBool1:" + testBool1
}
Label {
text: "testBool2:" + testBool2
}
Label {
text: "testBool3:" + testBool3
}
Label {
text: "testBool4:" + testBool4
}
}
https://redd.it/ktcpns
@qt_reddit
Qt QDomDocument API Escape characters issue
I'm reading a buffer out of a socket (xml format) into a qdomdoc via setContent. and the escape char "<" is already formatted as "<" prints out as "lt;"... for example:
"5 > 4" prints out as "5 lt; 6"
I'm probably missing something small and simple, anyone have any ideas what?
https://redd.it/ksii5d
@qt_reddit
Fresh Debian Sid, Android Studio, Qt Creator only 27 gigs and 15 hours later, priceless.
https://redd.it/krg5g1
@qt_reddit
New KDDockWidgets version released! v1.2.0 adds support for Wayland, WASM, and Qt 6
https://www.kdab.com/kddockwidgets-1-2-0-released/
https://redd.it/kqzly4
@qt_reddit
Design mode text editor, FakeVim?
Is there a way to use FakeVim in the design mode text editor? Its quite jarring when the design mode text editor differs from the edit mode text editor. Am I missing a setting, or is this a bug?
https://redd.it/kql28w
@qt_reddit
Commercial-only LTS phase starts: Closing the 5.15 branch(es) on 5th January
https://lists.qt-project.org/pipermail/development/2021-January/040798.html
https://redd.it/kqad02
@qt_reddit
Weekly What is everybody working on? Share your progress, discoveries, tips and tricks!
https://redd.it/kq3gm5
@qt_reddit
Error "QOpenGLFramebufferObject: Framebuffer incomplete attachment", causing ListView/ScrollView to turn black.
I'm having an issue with a ListView and paired QAbstractListView; when using certain inputs to my program, the ListView (and everything in the containing ScrollView, except one item I put on a higher z layer manually) turns black.
This error shows a few times in the terminal log:
QOpenGLFramebufferObject: Framebuffer incomplete attachment.
I've determined the cause is some of my ListView delegates (which are custom buttons), which base their width on values in the QAbstractListView; the maximum width I can give one of the bottoms before the error happens is 647,360, even going to 647,360.1 is enough to trigger it.
Even if I have multiple elements 647,360 pixels wide right beside each other, the glitch does not occur, it only happens if one individual element is that wide.
This darkness doesn't extend over the whole ListView however; near the edge, a few of the other delegate buttons are visible above the darkness, and then there is an edge beyond this where it's all visible again (until the next button that is too large that is), though sometimes, some of the other adjacent buttons do seem to get covered up as well:
https://imgur.com/a/l9f9lag
And the buttons DO work by the way (clickable, and the background), it's just the rendering that gets screwed up. As you can see in the pictures, one of the other elements in the ScrollView (the large grey rectangle, which has a MouseArea, and it is NOT a ListView delegate) is visible despite being potentially dozens of times wider than the offending delegates. The small grey square on the bottom is the ScrollView scrollbar handle.
As silly as it may sound, it's actually really important that these buttons be able to have such large widths, so I absolutely need to solve or work around this problem. What causes this problem, and how can it be solved?
I should point out splitting them into multiple doesn't seem viable as a solution, because each one must correspond with a single QAbstractListModel item (and this cannot be split either sadly), and syncing all of that (and maintaining the code/adding new features) would be horrible.
https://redd.it/kpm8uf
@qt_reddit
Using PySide2, how does one pass a variable from QLineEdit to another function?
I'm reading examples on other forums and they're quite confusing, somehow. I'm a bit new to Python so perhaps I don't understand how variables are passed in this situation. Here's what I'm trying to do:
@Slot()
def buttonClicked(myInput):
functionReceivingInput(myInput)
input = 0
textEntry = QLineEdit(input)
button = QPushButton("My Button")
button.clicked.connect(buttonClicked(input))
Is this the proper way to pass variables from QtWidgets to Python variables? Note, I'm not using my own classes of any sort, I'd prefer to keep this as simple as possible, unless it's otherwise not possible the way I'm doing it.
Thanks in advance!
https://redd.it/kp6rkt
@qt_reddit
How to update QWidget
​
[sketch of my app](https://preview.redd.it/zo8bpf4b9x861.png?width=954&format=png&auto=webp&s=ac716e1a8483390e8e49d7cee3fdb61e8ab130c3)
Hi. I'm new in Qt5. I have \*qwidget and when i push the buttons i need to change qwidget content. You can see sketch of my app on image. For every mode i have class like this:
class mode1{
private:
QScrollArea* frame;
public:
mode1(int some_param=1){
frame = new QScrollArea; // Just for example
// some code...
}
QWidget* get_widget(){
return this->frame;
}
// other code...
}
and i connect every button with switcher function
void QtApp::switcher(QString element) {
if (element != currnet_name) {
if (element == "mode1") {
ui.show = ui.mode1->get_widget(); // ui.show is *QWidget on sketch
}
else if (element == "mode2"){
ui.show = ui.mode2->get_widget();
}
// same statements
currnet_name = element;
}
}
for (int i = 0; i < labels.size(); i++) {
QPushButton* btn = new QPushButton(ui.centralWidget);
// some btn config
connect(btn, &QPushButton::clicked, [=] {switcher(labels[i]);});
layout.addWidget(btn); // layout is QVBoxLayout
}
the problem is when set ui.show new value, nothing changes. I've tried to change QScrollArea on QWidget, update ui.show (ui.show ->update()), but it isn't working.
https://redd.it/koxjbx
@qt_reddit
Adding waypoints to map Qt C++
hey guys, I have written a program in c++ using Qt that have a map. On this map I can add some waypoints using QGraphicsItem by Ctrl+rightClick. So far , everything works well but the problem is that when I want to move these waypoints and receive their new position through signal and slot mechanism, the program crashes. I have tried different method but nothing actually works for me. If you have any suggestion on how to do such thing I will appreciate if you help me with it. thank you .
https://redd.it/kot2at
@qt_reddit
QML Is there a way to wait in the middle of a function execution until I get a return value from a popup/dialog
I tried inserting something like this and it just froze the app. I know this is not the way to do it but this is the idea I'm trying to implement.while(popup.opened) {}
value = popup.someProperty
https://redd.it/ko9154
@qt_reddit
What would be the best way to go about making a widget like the one at the bottom-center of the screen here? It's essentially a file explorer, but with an icon view instead of a list view. A QTreeWidget would be my first choice, but I'd prefer something that looks more like this out of the box
https://redd.it/kmukuz
@qt_reddit
Understanding QML, C++, and Enumerations
I have a test project at [state_binding_test](https://github.com/jh3010-qt-questions/state_binding_test)
In [main.cpp](https://github.com/jh3010-qt-questions/state_binding_test/blob/main/main.cpp), I have:
~~~
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
QGuiApplication app( argc, argv );
qmlRegisterSingletonType<StateMachine>( "com.company.statemachine", 1, 0, "StateMachine", &StateMachine::qmlSingletonInstance );
qmlRegisterUncreatableType<Support>( "com.company.statemachine.support", 1, 0, "Support", QStringLiteral( "Support should not be created in QML" ) );
qRegisterMetaType<Support::ETestB>( "Support.ETestB" );
QQmlApplicationEngine engine;
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}
~~~
In [support.h](https://github.com/jh3010-qt-questions/state_binding_test/blob/main/support.h), I have
```
enum class ETestB
{
Ddddd,
Eeeee,
Fffff
};
Q_ENUM( ETestB );
```
In [main.qml](https://github.com/jh3010-qt-questions/state_binding_test/blob/main/main.qml), I have:
~~~
Label {
id: label
x: 54
width: 502
height: 33
text: {
console.log( "Aaaaa: ", StateMachine.Aaaaa );
console.log( "Aaaaa: ", StateMachine.Bbbbb );
console.log( "Aaaaa: ", StateMachine.Ccccc );
console.log( "Ddddd: ", Support.Ddddd );
console.log( "Eeeee: ", Support.Eeeee );
console.log( "Fffff: ", Support.Fffff );
return StateMachine.support.title;
}
anchors.top: parent.top
font.bold: true
font.pointSize: 24
anchors.topMargin: 49
anchors.horizontalCenter: parent.horizontalCenter
}
~~~
When I run the app, I see in the output:
~~~
qml: Ddddd: 0
qml: Eeeee: 1
qml: Fffff: 2
~~~
which is what is expected. However, I still have a few questions:
1. Does or should ```qmlRegisterUncreatableType``` and ```qRegisterMetaType``` need to go in main.cpp and be executed after ```QGuiApplication app```? Or is considered best practice, etc.?
2. ``` console.log( "Ddddd: ", Support.Ddddd );``` works, but I lose the explicit connection to the ETestB datatype. I would prefer to be able to write Support.ETestB.Ddddd or something. Is that possible now or something that might be implemented in a future version?
3. If I remove ```qRegisterMetaType```, current behavior remains the same. I am not sure what, exactly, qRegisterMetaType is doing for me here. Can someone provide some insight...?
4. Let's say that I add:
~~~
enum class ETestC
{
Ggggg,
Ddddd,
Eeeee,
Fffff
};
Q_ENUM( ETestC );
~~~
to the Support class. And ```qRegisterMetaType<Support::ETestC>( "Support.ETestC" );``` to the main function. There is now a namespace collision between ETestC and ETestB. According to some [documentation](https://doc.qt.io/qt-5/qtqml-cppintegration-data.html#enumeration-types), it seems like I should add ```Q_CLASSINFO( "RegisterEnumClassesUnscoped", "false" )``` to the Support class. However, when I do all of that, I see:
```
qml: Ddddd: undefined
qml: Eeeee: undefined
qml: Fffff: undefined
```
in the output. Clearly there is something I did not understand from the documentation.
I look forward to hearing from anyone who cares to comment so I can understand this system better.
https://redd.it/klrzez
@qt_reddit