I have written the following part of a code that adds two numbers together and outputs the result:
QIntValidator *validator = new QIntValidator(0,50,this);
ui->firstNumber->setValidator(validator);
...
...
In this case, I get the following error:
CS2039: 'setValidator': is not a member of QTextEditor
How can I fix this problem?
Use a text input class that supports validation. You probably want QLineEdit
Related
I have a model and everything was working fine. i was just changing some values to try different scenarios and adding some graphs when I got the error msg:
Error while drawing animation frame. possibly created by dynamic properties of animation shapes
The only message I could get from the console window is:
Error during model creation:
java.base/java.lang.String cannot be cast to java.base/java.lang.Double
what could be the cause of this error?
Somewhere in your code, you might have attempted to convert a string into a double.
String Message = "1.20";
double res = (double)Message;
The above code is not allowed in Java
A condition like this might have occurred.
You are not allowed to put a string into a double variable:
double res = "1.2";
I'm trying to create nested QMaps and in one of the QMap containers I have examples of my class as value, but im getting a ton of issues and I don't have any ideas how to fix them
Here's part of header file in which I create a nested QMaps
QMap<int, QMap<int,NormGraph*> > *MyWorkerMap ;
And here is a part of cpp file:
MyWorkerMap = new QMap<int, QMap<int,NormGraph*> >;
I get the following error :
worker.h:1:2: error: unterminated conditional directive // This issue appears when I'm trying to include NormGraph header inside of Worker header
Also I have like 9 issues which are like that:
Expected a type
Expected expression
Use of undeclared identifier(NormGraph, but this issue is quite strange because NormGraph.h was included into Worker.h)
All of these issues appear in one line of code:
QMap<int, QMap<int, NormGraph*> > *MyWorkerMap ;
I'm trying to create a benchmark for part of my 2D game framework (It's a QML extension) and I'm having problems to set a declarative script property of a QOBject.
The property declaration:
Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript NOTIFY scriptChanged)
And one of my attempts to change the script is something like this:
ScriptBehavior *behavior = new ScriptBehavior(entity);
QDeclarativeProperty(behavior, "script").write("console.log(1);");
But it doesn't work (Run the benchmark, but don't write anything to te console).
I've tried to use setProperty and manually create a QDeclarativeScriptString and set the property, but nothing works.
When I try to create the QDeclarativeScriptString, It fails:
The code:
ScriptBehavior *behavior = new ScriptBehavior(entity);
QDeclarativeScriptString scriptString;
scriptString.setScript("console.log(1)");
behavior->setScript(scriptString);
The output:
QFATAL : UpdateBenchmark::behavior() Received signal 11
FAIL! : UpdateBenchmark::behavior() Received a fatal error.
Loc: [Unknown file(0)]
Any help?
Thanks
I have a flex 4.5 application. I want to add new line in an mx:TextArea when certain event occurs. I have been searching for the proper way to add a OS independent line ending. I found out that the File class has lineEnding property. However the documentation states that this class is not exposed when running inside a browser (which is my case).
I have searched, but I couldn't find any other class, which can provide this information. Actually I am not sure if the TextArea line ending is OS dependent or not.
So actually I have two questions: Are TextArea line endings OS dependent or not? And if so, how can I get the proper line ending in flex?
You can use String.fromCharCode(13). This will return a line ending.
This is the equivalent of PHP's chr() method.
Example:
var address_str:String = "dog" + String.fromCharCode(64) + "house.net";
trace(address_str); // output: dog#house.net
From my experience, "\r" works in both Windows and Mac.
Quite simply, you just need to add the newline character to the text of the textArea.
myTextArea.text+="\n"; //This should work, if not try the other two
myTextArea.text+="\r";
myTextArea.text+="\r\n";
I am trying to use ControlCommands with a .NET application (hence, these should all be standard Microsoft controls), but most of the ones that are of interest don't seem to do anything.
I am currently looking at a combobox (the drop down box). I used the "showdropdown" command to have it drop down, and it worked successfully.
I then tried to use "SelectString", but it didn't go to the string that I specified. How does the "SelectString" ControlCommand option work?
I have also tried "SetCurrentSelection".
This is the statement I used:
ControlCommand($windowName, "", "[Name:myComboBox]", "SelectString", "a")
I have also tried searching for it first with:
ControlCommand($windowName, "", "[Name:myComboBox]", "FindString", "a")
but it didn't find it either. Strange, the single character "a" is there.
If it helps, this is the control class: WindowsForms10.COMBOBOX
_GUICtrlComboBox_xxx functions also work on external controls. For example, _GUICtrlComboBox_FindString, _GUICtrlComboBox_SelectString, _GUICtrlComboBox_SetCurSel. Try those instead.
Call ControlGetHandle first, then use this handle to call the functions above.
Remember to include the GuiComboBox library, otherwise you will get an error message "Error: Unknown function name":
#include <GuiComboBox.au3>
You can send key presses to this control, like this:
ControlSend("Window title", "", "[NAME:comboBoxName]", "ComboBox value")
It works because ComboBox interprets input as a search string and selects the first item starting with this string.
Note: Because it searches the matching item as you type, there's no need to send a complete value, only the shortest substring.