kbalar
kbalar

Reputation: 359

QML: not able to see text on TextInput element of QML

I have created qml/test.qml file as:

import QtQuick 1.0
Rectangle
{
    id: pahe
    width: 200; height: 50
    color: "#55aaee"
    TextInput
    {
        id: editor
        anchors
        {
            left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10
            verticalCenter: parent.verticalCenter
        }
        cursorVisible: true; 
        font.bold: true
        color: "#151515"; 
        selectionColor: "Green"
        focus: true
    }
}

and One qml/main.cpp file as:

#include <QApplication>
#include <QtDeclarative>
#include <QDeclarativeView>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QDeclarativeView view;
    view.setSource(QUrl::fromLocalFile("test.qml"));

    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);

    view.show();
    return app.exec();
}

I am compiling this main.cpp file using commands like:

#qmake -project
#qmake
#make

and I am running the exe as:

./qml

So problem is that I am not able to see any text on TextInput even after entering text using key board. If i print the TextInput.text of element it shows entered text on console log but can not see on screen. What could be the reason?

If i run same test.qml file using qmlviewer it works fine.
Any hint or comment in this would be helpful.

Thanks,
KBalar

Upvotes: 3

Views: 1900

Answers (2)

kbalar
kbalar

Reputation: 359

The problem was with virtual Linux machine running on Windows PC. So If i run same example on Real Linux machine The problem wont be there.

Upvotes: 1

RajaRaviVarma
RajaRaviVarma

Reputation: 2742

why don't you try simulator? U said, it as an exe and why r u running it in a Linux style "./". If you still have the problem, check the background of the Rectangle or TextEdit and the font color.

Upvotes: 1

Related Questions