Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Need assistance from QT programmer

    Reply
    Page 16 of 18 | Prev | 6   14     15   16   17     18   | Next
    Diph | # 151 | 2010-09-30, 11:07 | Report

    Wild idea.

    Reimplement void QLineEdit::focusOutEvent ( QFocusEvent * e ) and check what QLineEdit::validator()::validate() returns.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    CepiPerez | # 152 | 2010-09-30, 11:07 | Report

    So you want to revert to original value in the text lenght is < 7 ?
    You can use focusInEvent to save the original text in a qstring and focusOutEvent to revert.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to CepiPerez For This Useful Post:
    d-iivil

     
    d-iivil | # 153 | 2010-09-30, 11:09 | Report

    Originally Posted by nicolai View Post
    Is the behavrio different, if you use setInputMask instead
    of a validator?

    http://doc.trolltech.com/4.7/qlineed...inputMask-prop

    ui->line_edit_font1->setInputMask("\#NNNNNN");

    regards
    Nicolai
    Then I can't input anything since it wants me to input all seven digits at the same time (copy paste works, but I can't type the digits one by one).

    Edit | Forward | Quote | Quick Reply | Thanks

     
    nicolai | # 154 | 2010-09-30, 11:38 | Report

    That is strange, btw my example was wrong. The format
    for Hex-Digits is "HHHHHH". I am pretty sure this should work.
    But I can not try it out at the moment. Can you try again with the
    format:
    ui->line_edit_font1->setInputMask("HHHHHH");

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to nicolai For This Useful Post:
    d-iivil

     
    d-iivil | # 155 | 2010-09-30, 13:08 | Report

    Originally Posted by nicolai View Post
    That is strange, btw my example was wrong. The format
    for Hex-Digits is "HHHHHH". I am pretty sure this should work.
    But I can not try it out at the moment. Can you try again with the
    format:
    ui->line_edit_font1->setInputMask("HHHHHH");
    Thanks! Will test it out tomorrow Didn't know there was an input mask for hexes already existing

    Edit | Forward | Quote | Quick Reply | Thanks

     
    d-iivil | # 156 | 2010-09-30, 13:09 | Report

    Originally Posted by CepiPerez View Post
    So you want to revert to original value in the text lenght is < 7 ?
    You can use focusInEvent to save the original text in a qstring and focusOutEvent to revert.
    I can't see such signals in Qt Creator when I right click the lineEdit and select "Go to slot...".

    Edit | Forward | Quote | Quick Reply | Thanks

     
    laitiju | # 157 | 2010-09-30, 13:24 | Report

    They aren't signals. They are virtual methods. You have to reimplement those methods to use them.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Diph | # 158 | 2010-09-30, 13:49 | Report

    I don't know how you can use this in Qt Designer, but you can use those methods like this:

    mylineedit.h
    PHP Code:
    #ifndef MYLINEEDIT_H
    #define MYLINEEDIT_H

    #include <QLineEdit>

    class MyLineEdit : public QLineEdit
    {
        
    Q_OBJECT
    public:
        
    MyLineEdit(QWidget *parent = 0);

    protected:
        
    void focusOutEvent(QFocusEvent *event);
        
    void focusInEvent(QFocusEvent *event);

    };

    #endif // MYLINEEDIT_H 
    mylineedit.cpp
    PHP Code:
    #include "mylineedit.h"

    MyLineEdit::MyLineEdit(QWidget *parent) :
        
    QLineEdit(parent)
    {
    }

    void MyLineEdit::focusInEvent(QFocusEvent *event)
    {
        
    //Save text from line edit
    }

    void MyLineEdit::focusOutEvent(QFocusEvent *event)
    {
        
    //Restore text if it is not valid
    } 

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Diph For This Useful Post:
    d-iivil

     
    Berserk | # 159 | 2010-10-01, 22:14 | Report

    Sorry for changing the subject, but the GConfItem problem still remains for both D-Livil and me..



    Originally Posted by Diph View Post
    Install lib in scratchbox armel target and make links of gconf lib and include files under usr and place them in NokiaQtSDK Maemo usr/lib and usr/include.
    I use WinXP, and I'm afraid I can't install libs using Madde, or is it possible?

    I've downloaded libgq-gconf-dev_0.2-3+0m5_armel.deb from the package page,
    Then I unpacked everything into:
    E:\NokiaQtSDK\Maemo\4.6.2\sysroots\fremantle-arm-sysroot-1030-slim\usr
    and added your suggestion to src.pro:
    Originally Posted by Diph View Post
    Code:
    CONFIG += link_pkgconfig
    PKGCONFIG += gq-gconf
    But I still can't include GConfItem..
    Copying doesn't seem like the right way to do it, but I'm clueless.

    ==================================================

    I did manage to include GConfItem by putting these files in my project, but those files also had their own includes, and it seemed endless to me.
    It wouldn't build because I don't have those headers.

    Another thing.. I see "#include <gconf/gconf.h>" here and there, but in my setup it's "#include <gconf/2/gconf/gconf.h>". I didn't change anything manually, just a straightforward Nokia Qt SDK install.
    The #include lines in those headers point to <gconf/....h>, so that's a dead end.


    I hope I don't bother anyone too much about this, but any help would be great

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by Berserk; 2010-10-01 at 22:22.

     
    Berserk | # 160 | 2010-10-02, 00:24 | Report

    Well.. I think it's solved

    Use system("command");
    But be careful with system commands

    For instance, when you use
    Code:
    system("gconftool-2 -R /apps/osso/hildon-desktop/views");
    It outputs this:
    Code:
     current = 1
     active = [1,2,3,4]
     /apps/osso/hildon-desktop/views/1:
      bg-image = /home/user/MyDocs/.images/abstract1_01.jpg
     /apps/osso/hildon-desktop/views/2:
      bg-image = /home/user/MyDocs/.images/abstract1_02.jpg
     /apps/osso/hildon-desktop/views/3:
      bg-image = /home/user/MyDocs/.images/abstract1_03.jpg
     /apps/osso/hildon-desktop/views/4:
      bg-image = /home/user/MyDocs/.images/abstract1_04.jpg
    I'll write how to catch that output in a QString tomorrow, time for some sleep first..


    I've been able to set backgrounds with the following:
    Code:
    system('gconftool -s /apps/osso/hildon-desktop/views/1/bg-image -t string "/home/user/MyDocs/.images/abstract1_01.jpg"');
    (For every desktop)

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by Berserk; 2010-10-02 at 01:27.
    The Following User Says Thank You to Berserk For This Useful Post:
    d-iivil

     
    Page 16 of 18 | Prev | 6   14     15   16   17     18   | Next
vBulletin® Version 3.8.8
Normal Logout