maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Need assistance from QT programmer (https://talk.maemo.org/showthread.php?t=58569)

Diph 2010-09-30 11:07

Re: Need assistance from QT programmer
 
Wild idea. :D

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

CepiPerez 2010-09-30 11:07

Re: Need assistance from QT programmer
 
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.

d-iivil 2010-09-30 11:09

Re: Need assistance from QT programmer
 
Quote:

Originally Posted by nicolai (Post 830003)
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).

nicolai 2010-09-30 11:38

Re: Need assistance from QT programmer
 
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");

d-iivil 2010-09-30 13:08

Re: Need assistance from QT programmer
 
Quote:

Originally Posted by nicolai (Post 830020)
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 :)

d-iivil 2010-09-30 13:09

Re: Need assistance from QT programmer
 
Quote:

Originally Posted by CepiPerez (Post 830006)
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...".

laitiju 2010-09-30 13:24

Re: Need assistance from QT programmer
 
They aren't signals. They are virtual methods. You have to reimplement those methods to use them.

Diph 2010-09-30 13:49

Re: Need assistance from QT programmer
 
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



Berserk 2010-10-01 22:14

Re: Need assistance from QT programmer
 
Sorry for changing the subject, but the GConfItem problem still remains for both D-Livil and me..



Quote:

Originally Posted by Diph (Post 826131)
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:
Quote:

Originally Posted by Diph (Post 826077)
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

Berserk 2010-10-02 00:24

Re: Need assistance from QT programmer
 
Well.. I think it's solved :D

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

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)


All times are GMT. The time now is 15:49.

vBulletin® Version 3.8.8