Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • [Solved]Adding custom widget ( class ) into made in Qt Designer ui class

    12
    0 Votes
    12 Posts
    18k Views
    G
    Glad to hear the problem is solved. You can "close" the thread by editing your very first post and add "[Solved]" to the beginning of the subject.
  • QTabWidget Question

    4
    0 Votes
    4 Posts
    2k Views
    M
    Oh sherbert sorry - i copied and pasted my code without thinking. This was me just playing around to see if i can try and sort the problem. But i see rokemoon has helped with the size problem.. I'll try that - thanks!!
  • How to resize QMainWindow after removing all DockWidgets?

    6
    0 Votes
    6 Posts
    6k Views
    S
    Yes, you can get hold of the internal layout of the QMainWindow by calling layout() on it.
  • Can Someone Explain "this" Portion of the Qt Framework?

    9
    0 Votes
    9 Posts
    4k Views
    G
    [quote author="mehoggan" date="1313658650"]Okay thanks for the input. So this behaves "somewhat" like MFC, in the since that the message pump and the WinMain site inside a DLL. Thank you for the clarification.[/quote] yep The message pump is your qApp->exec() call.
  • ::close(fd) won't close v4l2 capture device inside QThread run(..) method

    5
    0 Votes
    5 Posts
    5k Views
    D
    Thanks again for the reply, I've moved the ::open(..)/::close(...) calls to a class outside my capture class (so doesn't inherit from Qthread) and now the close call is executing correctly. Don't really understand that but maybe I'll revisit one day! Thanks for the QImage buffer tip, I need to pick up as many of these as I can now...
  • How to make te selected columns of QTableWidget as ReadOnly

    2
    0 Votes
    2 Posts
    6k Views
    G
    You can set the items in the even columns to read only like this: @ QTableWidgetItem *twItem = tableWidget->item(3, 4); twItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); // if you do not need selectable items this is ok: twItem->setFlags(Qt::NoItemFlags); @ Or set the flags during creation of the items, of course.
  • [SOLVED] textEdit: how to remove the margins of mainwindow

    8
    0 Votes
    8 Posts
    8k Views
    K
    i solved it with the following code. @QMainWindow::centralWidget()->layout()->setContentsMargins(0,0,0,0);@
  • How to convert whole qt gui application from portrait to landscape mode

    8
    0 Votes
    8 Posts
    5k Views
    M
    may be you can try setVerticalScrollBarPolicy() setHorizontalScrollBarPolicy().
  • How to include a .qrc in another .qrc file?

    4
    0 Votes
    4 Posts
    4k Views
    F
    Thanks, I will try that!
  • Pass a QImage to an opengl GLSL sampler

    3
    0 Votes
    3 Posts
    5k Views
    V
    I don't know if I made myself clear, but if you need further help, just ask.
  • JavaScript override

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • 32bit Integer cap on 64bit OS

    5
    0 Votes
    5 Posts
    4k Views
    P
    Kaohnig and Volker hit the nail on the head. Because npts was only an int, the computation was downcast regardless of the type I assigned to nrows. Since I can't change the type of npts (it comes from other code... I showed it adjacent for clarity in my post), I had to recast it during the nrows computation: @int npts = 71338; quint64 nrows = quint64(npts) * ( quint64(npts) - 1 ); //5089038906 as expected@ Thanks for the help! I knew it was something obvious.
  • Image Resizing in QGraphics

    4
    0 Votes
    4 Posts
    5k Views
    F
    Try QGraphisPixmapItem: "http://doc.qt.nokia.com/4.7/qgraphicspixmapitem.html#details":http://doc.qt.nokia.com/4.7/qgraphicspixmapitem.html#details The easiest way: You can set the scale of the QGraphicsView: "http://doc.qt.nokia.com/4.7/qgraphicsview.html#scale":http://doc.qt.nokia.com/4.7/qgraphicsview.html#scale The "scale" method uses two factors, one for X and another for Y. As I understand, you will always keep the Y factor as 1.0 . But before setting a new scale (a particular case of transformation), you will need to reset the previous transformation: "http://doc.qt.nokia.com/4.7/qgraphicsview.html#resetTransform":http://doc.qt.nokia.com/4.7/qtransform.html#scale A bit more complicated, as that might be a little bit more slower than really understanding the transformations and applying a calculated one, adjusted for the difference in scale, rather than reseting and setting a new one. Create a QTransform and apply to it the scale you need: "http://doc.qt.nokia.com/4.7/qtransform.html#scale":http://doc.qt.nokia.com/4.7/qtransform.html#scale Then apply it to the QGraphicsView without combining it with the previous transformation: "http://doc.qt.nokia.com/4.7/qgraphicsview.html#setTransform":http://doc.qt.nokia.com/4.7/qgraphicsview.html#setTransform Your resize event might do this: get new width; calculate the ratio between this and the first ever width; create a QTransform object and set its scale properly; apply this to the QGraphicsView using its setTransform method without combination to the previous; OR get new width; calculate the ratio between this and the last one; save width for future use; create a QTransform object and set its scale properly; apply this to the QGraphicsView using its setTransform method combining it to the previous; I have never tried to do this, but I guess that will work as expected. Hope this helps, Francisco
  • [Solved]Member variables don't seem to exist inside class

    11
    0 Votes
    11 Posts
    4k Views
    M
    Well, after tinkering with it, I was able to get signals and slots to essentially do what I want. I'll mark this as solved.
  • Defining buttons in OpenGL-window

    8
    0 Votes
    8 Posts
    8k Views
    L
    Qt is big, but pretty easy when you start getting a hang of it... To just understand what you can do with a layout, simply add a QVBoxLayout to your mainLayout, and add some buttons to it, something like this (where the first two lines are already in your code): @ QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addWidget(glWidget); QVBoxLayout *vLayout = new QVBoxLayout; mainLayout->addLayout(vLayout); QPushButton *button1 = new QPushButton("Button 1"); vLayout->addWidget(button1); QPushButton *button2 = new QPushButton("Button 2"); vLayout->addWidget(button2); vLayout->addStretch(); @
  • Connect to a remote MySql database

    8
    0 Votes
    8 Posts
    10k Views
    B
    I see. Maybe they could find a way to make it all a bit less trouble though. No worries though. I seem to have it working OK now and I can get on with my project. Thanks for the help.
  • [Moved] How to display in an editor the result of encryption

    8
    0 Votes
    8 Posts
    3k Views
    S
    It work thank you
  • Newbie Qtabwidget Question

    5
    0 Votes
    5 Posts
    3k Views
    M
    Thanks for this - I think i'll use QWidget instead of QDialog as a parent class. However, i have managed to get it working but the size is just a little weird. It cuts off 3 quarters of my dialog window so i have to manually resize this each time the app is run. I'm hoping that using QWidget instead of QDialog will sort this..
  • Setting global variable in main() [Solved]

    8
    0 Votes
    8 Posts
    21k Views
    K
    [quote author="Andre" date="1313579823"]Personally, I dislike global variables. I find there are really no good use cases for them. What you can do instead, is use QApplication to hold your application wide data. You can either: Subclass QApplication, and give it proper access methods to your data, or Use Qt' s dynamic property feature to just set a QVariant property on your QApplication object However, it is just a personal dislike. The language supports it (and Qt does nothing that constrains your use of it), so go right ahead if you must. [/quote] Andre, you are raising certainly a valid point with your response. Global variables have always some "smell" of the old "FORTRAN common block". Hard to controll because completely confusing when you are looking for the place changing some part of your data. One must have no other alternative when using global variables. Otherwise they may be the start of disaster.
  • Tr member function of QObject takes only char * as input parameter

    11
    0 Votes
    11 Posts
    6k Views
    V
    "untranslated string as additional itemData" seems to be better option. i will give it a try. Thanks