?
Solved

In a QT QLineEdit class - is it possible to have more than one input mask?

Posted on 2010-08-17
5
Medium Priority
?
927 Views
Last Modified: 2013-11-23
Hello,

I have a QT project which uses a QLineEdit class.

What I want to do, spedifically, is to have the user be able only to input a time value (ie:  "12:34:26") OR a singel "*" character to indicate a wildcard.

I can restrict the user to either by using the the setInputMask function.  However, I cannot do both at the same time.

Thanks in Advance,
Tim
0
Comment
Question by:tmitch68
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:irfan_omair
ID: 33456730
Hi
Did you try using QTimeEdit class, does this solve your problem? If not let me know I will work further to help you.
0
 

Author Comment

by:tmitch68
ID: 33456887
Thanks - that actually does help a lot to use a QTimeEdit class rather than a QLineEdit class with an input mask.  The formatting is much better/easier.

Is there any way to allow the user to type in a single "*" value, though - to signify a wildcard.

If not, I'll still give you credt.

Thanks,
Tim
0
 
LVL 7

Accepted Solution

by:
irfan_omair earned 2000 total points
ID: 33457257
Do you want to show both time and ' * ' ?? If yes I am afraid that will not be possible without breaking QDateTime properties which are required to show time in any format and it will require hell of the work as you will have to re write several virtual function.

If time and * bother are needed in same line edit I suggest to use QLineEdit and append time value and * in one string and display that , this will be much easier than hacking QTimeEdit to show * in that .
0
 

Author Comment

by:tmitch68
ID: 33457319
Actually - I just found something that DOES allow the user to put in either a time value or a '*' value - just call the setSpecialValue("*") function on the QTimeEdit class when you create it - it then allows the user to type in whatever they've passed in as a parameter (a single '*' char in this case).

Thanks - I would not have figured this out if you had not suggested going with a QTimeEdit class.
0
 
LVL 7

Expert Comment

by:irfan_omair
ID: 33457345
Thats great I m glad you got it working.
I was looking directly in the code and I found it needs hell of the things to do.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question