Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • 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
  • Adapt OpenGL Code to Qt (especially keyPressEvent)

    9
    0 Votes
    9 Posts
    6k Views
    B
    Thanks for your replies. The problem was that i used the keypressfunction in the wrong class. My mistake. Nevertheless I thank you for your anwers.
  • How to draw this shape

    2
    0 Votes
    2 Posts
    2k Views
    D
    No, you can draw it pretty much anywhere you want (even on an ordinary QWidget). About the actual drawing: a filled QPainterPath?
  • Using Linux fonts for Qt application[solved]

    9
    0 Votes
    9 Posts
    11k Views
    V
    Solved. Thanks a lot Gerolf for very useful info. on further investigation, found that qt 3.0.4 version uses core X font subsystem on Linux. Hence it will take the fonts which are installed in core X. Also found that qt 3.3.6 and maybe all the higher versions of qt uses fontconfig subsystem. fontconfig is a new subsystem, and it will eventually replace core x font subsystem (from linux forums) Thanks Gerolf
  • QtHtml5Script anyone?

    9
    0 Votes
    9 Posts
    3k Views
    P
    For the server side, the the QtScript generator would be all you need. http://code.google.com/p/qtscriptgenerator/ but it needs some work as not all the examples worked for me. I thought that if I wanted to include the QtScript generator examples then it would have to be GPL as well. I sent an email about this issue to Nokia and am awaiting feedback.
  • Using 3d models (.obj) AND materials (.mtl) in an opengl application

    15
    0 Votes
    15 Posts
    30k Views
    K
    [quote author="hurricane" date="1313562019"]I want to load 3D models and textures for symbian 3 devices using Qt with openGL ES 1.1 . Can u provide some example for that... Regards hurr[i]cane[/quote] Ah, for symbian... Then I guess you can't use GLC Lib. (laumaya?) However I think you should be able to use Qt 3d. I haven't tried it on symbian. So I don't have exact pointers for you there.
  • Qt handle native messages?

    6
    0 Votes
    6 Posts
    6k Views
    L
    result is the "system-dependant":http://goo.gl/t8Cg3, "message-dependant":http://goo.gl/G1e1Q result of the message. "In your case":http://goo.gl/oL2jS zero if the message has been processed.
  • [SOLVED] lineEdit to wrap text

    9
    0 Votes
    9 Posts
    11k Views
    L
    I kinda have a hunch that that would solve the problem.
  • [SOLVED] textEdit textChanged return key

    2
    0 Votes
    2 Posts
    3k Views
    K
    I found a solution to my textEdit problem and it can be found "here...":http://developer.qt.nokia.com/forums/viewthread/8828/
  • Click on QPushButton crashes the application!!

    6
    0 Votes
    6 Posts
    4k Views
    G
    It's still not changed. I've created a new bug report "QTBUG-20953":https://bugreports.qt.nokia.com/browse/QTBUG-20953 specific to this bug.
  • Read HTTP POST data with QTcpSocket

    Moved
    10
    0 Votes
    10 Posts
    9k Views
    G
    [quote author="nilotpal" date="1313514417"]Thank you Volker for stopping by, I actually got the idea of converting the message into associative array after reading the RFCs. But I missed the obvious point that the message may not have arrived in its entirety at first read. So I guess I'll have to set up a watch dog and read the message once it has arrived fully. [/quote] You don't know that from the socket. The TCP connection may not necessarily closed once the request has been sent completely (keep alive connections). The watchdog is not needed, IMHO. As soon as there is new data availabel, you'll be notified by the signals.