Solved

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

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What (WYSIWYG) editor is used for questions and comments? 5 136
Doxygen plugin for Android Studio 1 555
how to bring to back always mid parent image form 21 79
Syntax Error 2 62
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

786 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