Solved

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

Posted on 2010-08-17
5
869 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 500 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now