Solved how to add pictures to a qt widget table in qt
-
i am new to qt
how to create a table that show information about student so what would i use in the program
i have an idea of creating a table but i don't know how to add pics inside of it
any ideas ? -
Hi and welcome to devnet,
Do you mean some sort of address book ?
-
thanks for replying back
and thank you,i saw the example on the qt documentation about the address books, and i liked it but,
my program is some sort of school management
in the center of it there is tabs of different functionalities
inside those tabs i want my data which is a mysql data to get displayed to the user
like picture,first names,last names and so
what is the best thing i can do about this idea
thanks again <3 -
@SGaist and what u think sir,
creating a web site and getting it inside a web widget
whats the best path to use/follow -
@the_owler said in how to add pictures to a qt widget table in qt:
creating a web site
Well, there are many many possibilities/frameworks and this is out of Qt scope (even if you could use Qt to create a web page).
"and getting it inside a web widget" - do you mean you want to render a web page in your app? If so take a look at https://doc.qt.io/qt-5/qtwebengine-index.html -
@jsulm
i give you the general approach and tell me what to do
i have created a full c++ console app
which is a school management console app
with c++ connector(with mysql)
then i get in with the qt to have the desktop app
but am getting a lot of difficulties in learning and implementing things inside the mainwindow and getting a good design as i want
so i decided maybe to create a website then implement it inside my app
what do you recommend
and thanx for replying,
and sorry for the long text -
Well, user management systems are often coupled with web technologies.
Is it your case ?
As for getting data into widget, QDataWidgetMapper comes to mind.
-
@SGaist and is it possible to put pictures inside QDataWidgetMapper ?
-
QDataWidgetMapper does the link between widgets and database fields.
How are you storing images in that database ?
-
@SGaist its a mysql server with a database
i am using c++ connector
and reading a pic image binary and store it inside the database in a longblob or blob var type -
Is the format of the picture fixed ?
-
sorry for late xD 600 second cooldown
@SGaist u mean by fixed is that a single format ? like png or jpg ?
if so no it wwill be just one format
and its controlable by the user*its a desktop app that is controlable by just one user so the format type is not an issue
-
Will you use a QTableView ? If so you can either use a custom QIdentityProxyModel that will create a QPixmap from the blob for the DecorationRole or a custom QStyledItemDelegate to draw the blob.
-
@SGaist you think qtableview is the best way to show the data ? or there is other better way to do it
if not thank you so much
that was very helpful <3 -
It depends on how you want your user to access the data.
-
i want something like this picture :
Student Management System
with some pics on each student -
This looks like a classic web application.
While you can do the front end with Qt, I think you should first rethink your backend architecture to provide all the services needed to manage such an application.
-
thank you so much <3