SimCardInfo issue on Blackberry10 - qml

I'd like to display/get a read on IMSI (tested it on Dev Alpha B). The issue is that I could get a read on others property of SimCardInfo such as Mobile Network Code, Mobile Country Code, Serial Number but IMSI (subscriberIdentifier).
Here is the code
main.cpp
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/device/HardwareInfo>
#include <bb/device/SimCardInfo>
#include <QLocale>
#include <QTranslator>
#include <Qt/qdeclarativedebug.h>
using namespace bb::cascades;
using namespace bb::device;
Q_DECL_EXPORT int main(int argc, char **argv)
{
qmlRegisterUncreatableType<bb::device::HardwareInfo>("bb.device", 1, 0, "HardwareInfo", "");
qmlRegisterUncreatableType<bb::device::SimCardInfo>("bb.device", 1, 0, "SimCardInfo", "");
// this is where the server is started etc
Application app(argc, argv);
// localization support
QTranslator translator;
QString locale_string = QLocale().name();
QString filename = QString( "hwinfo_%1" ).arg( locale_string );
if (translator.load(filename, "app/native/qm")) {
app.installTranslator( &translator );
}
//create object
HardwareInfo hwInfo;
SimCardInfo simcardInfo;
QmlDocument *qml = QmlDocument::create("asset:///main.qml");
qml->setContextProperty("_hardware", &hwInfo);
qml->setContextProperty("_simcardinfo", &simcardInfo);
// create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// set created root object as a scene
Application::instance()->setScene(root);
// we complete the transaction started in the app constructor and start the client event loop here
return Application::exec();
// when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
}
main.qml file
import bb.cascades 1.0
import bb.device 1.0
Page
{
Container
{
leftPadding: 20
topPadding: 20
Container
{
topMargin: 10
layout: StackLayout
{
orientation: LayoutOrientation.LeftToRight
}
Button
{
text: "retrieve"
onClicked:
{
lbl0.text = "Model name: " + _hardware.modelName
lbl1.text = "IMEI: " + _hardware.imei
lbl2.text = "IMSI: " + _simcardinfo.subscriberIdentifier
lbl3.text = "SN: " + _simcardinfo.serialNumber
lbl4.text = "Mobile Network Code: " + _simcardinfo.mobileNetworkCode
lbl5.text = "Mobile Country Code: " + _simcardinfo.mobileCountryCode
}
}
}
Container
{
layout: StackLayout {
}
Label
{
id:lbl0
}
Label
{
id:lbl1
}
Label
{
id:lbl2
}
Label
{
id:lbl3
}
Label
{
id:lbl4
}
Label
{
id:lbl5
}
}
}
}
Any help is much appreciated.
reference
http://developer.blackberry.com/cascades/reference/bb_device_simcardinfo.html

You're declaring hwInfo and simCardInfo as stack variables, that means that after the constructor ends both variables no longer exist, so when the QML runtime tries to access the properties you assigned to them it just can't.
To make it work you need to declare those variables as heap variables so they can outlive their scope.
HardwareInfo* hwInfo = new HardwareInfo();
SimCardInfo* simcardInfo = new SimCardInfo();
qml->setContextProperty("_hardware", hwInfo);
qml->setContextProperty("_simcardinfo", simcardInfo);

Related

create my own resource types (tf.resource)

My current code:
// For Eigen::ThreadPoolDevice.
#define EIGEN_USE_THREADS 1
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/resource_mgr.h"
#include "tensorflow/core/framework/resource_op_kernel.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/types.h"
using namespace tensorflow;
REGISTER_OP("ArrayContainerCreate")
.Attr("T: type")
.Attr("container: string = ''")
.Attr("shared_name: string = ''")
.Output("resource: resource")
.SetIsStateful()
.SetShapeFn(shape_inference::ScalarShape)
.Doc(R"doc(Array container, random index access)doc");
REGISTER_OP("ArrayContainerGetSize")
.Input("handle: resource")
.Output("out: int32")
.SetShapeFn(shape_inference::ScalarShape)
;
// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/framework/resource_mgr.h
struct ArrayContainer : public ResourceBase {
ArrayContainer(const DataType& dtype) : dtype_(dtype) {}
string DebugString() override { return "ArrayContainer"; }
int64 MemoryUsed() const override { return 0; };
mutex mu_;
const DataType dtype_;
int32 get_size() {
mutex_lock l(mu_);
return (int32) 42;
}
};
// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/framework/resource_op_kernel.h
class ArrayContainerCreateOp : public ResourceOpKernel<ArrayContainer> {
public:
explicit ArrayContainerCreateOp(OpKernelConstruction* context) : ResourceOpKernel(context) {
OP_REQUIRES_OK(context, context->GetAttr("T", &dtype_));
}
private:
virtual bool IsCancellable() const { return false; }
virtual void Cancel() {}
Status CreateResource(ArrayContainer** ret) override EXCLUSIVE_LOCKS_REQUIRED(mu_) {
*ret = new ArrayContainer(dtype_);
if(*ret == nullptr)
return errors::ResourceExhausted("Failed to allocate");
return Status::OK();
}
Status VerifyResource(ArrayContainer* ar) override {
if(ar->dtype_ != dtype_)
return errors::InvalidArgument("Data type mismatch: expected ", DataTypeString(dtype_),
" but got ", DataTypeString(ar->dtype_), ".");
return Status::OK();
}
DataType dtype_;
};
REGISTER_KERNEL_BUILDER(Name("ArrayContainerCreate").Device(DEVICE_CPU), ArrayContainerCreateOp);
class ArrayContainerGetSizeOp : public OpKernel {
public:
using OpKernel::OpKernel;
void Compute(OpKernelContext* context) override {
ArrayContainer* ar;
OP_REQUIRES_OK(context, GetResourceFromContext(context, "handle", &ar));
core::ScopedUnref unref(ar);
int32 size = ar->get_size();
Tensor* tensor_size = nullptr;
OP_REQUIRES_OK(context, context->allocate_output(0, TensorShape({}), &tensor_size));
tensor_size->flat<int32>().setConstant(size);
}
};
REGISTER_KERNEL_BUILDER(Name("ArrayContainerGetSize").Device(DEVICE_CPU), ArrayContainerGetSizeOp);
I compile that. Note that I first got some undefined symbol: _ZN6google8protobuf8internal26fixed_address_empty_stringE error but I resolved that by adding these additional compiler flags:
from google.protobuf.pyext import _message as msg
lib = msg.__file__
extra_compiler_flags = [
"-Xlinker", "-rpath", "-Xlinker", os.path.dirname(lib),
"-L", os.path.dirname(lib), "-l", ":" + os.path.basename(lib)]
I read about that here.
Then I load that as a module via tf.load_op_library.
Then, I have this Python code:
handle = mod.array_container_create(T=tf.int32)
size = mod.array_container_get_size(handle=handle)
When I try to evaluate size, I get the error:
InvalidArgumentError (see above for traceback): Trying to access resource located in device 14ArrayContainer from device /job:localhost/replica:0/task:0/cpu:0
[[Node: ArrayContainerGetSize = ArrayContainerGetSize[_device="/job:localhost/replica:0/task:0/cpu:0"](array_container)]]
The device name (14ArrayContainer) somehow seem to be messed up. Why is that? What is the problem with the code?
For some more testing, I added this additional code in the ArrayContainerCreateOp:
ResourceHandle rhandle = MakeResourceHandle<ArrayContainer>(context, cinfo_.container(), cinfo_.name());
printf("created. device: %s\n", rhandle.device().c_str());
printf("container: %s\n", rhandle.container().c_str());
printf("name: %s\n", rhandle.name().c_str());
printf("actual device: %s\n", context->device()->attributes().name().c_str());
printf("actual name: %s\n", cinfo_.name().c_str());
This gives me the output:
created. device: 14ArrayContainer
container: 14ArrayContainer
name: 14ArrayContainer
actual device: /job:localhost/replica:0/task:0/cpu:0
actual name: _2_array_container
So clearly, there is some of the problem.
This looks like something is messed up with the protobuf? Maybe I am linking the wrong lib? But I have not found which lib to link instead.
(I also posted an issue about this here.)
That is upstream bug 10950, which should be fixed in TensorFlow 1.2.2.

How to io_control of boost library socket with customized command

I' trying to make an identical function to "ioctl" in c++ style using boost library.
Here is my "c" style code:
int sockfd;
char * id;
struct iwreq wreq;
memset(&wreq, 0, sizeof(struct iwreq));
sprintf(wreq.ifr_name, IW_INTERFACE);
if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
fprintf(stderr, "Cannot open socket \n");
fprintf(stderr, "errno = %d \n", errno);
fprintf(stderr, "Error description is : %s\n",strerror(errno));
exit(1);
}
printf("Socket opened successfully \n");
id = malloc(IW_ESSID_MAX_SIZE+1);
wreq.u.essid.pointer = id;
if (ioctl(sockfd, SIOCGIWESSID, &wreq)) {
fprintf(stderr, "Get ESSID ioctl failed \n");
fprintf(stderr, "errno = %d \n", errno);
fprintf(stderr, "Error description : %s\n",strerror(errno));
exit(2);
}
printf("IOCTL Successfull\n");
printf("ESSID is %s\n", wreq.u.essid.pointer);
I found some relevant example, but I'm not clear how to use it correctly. example
Main function:
boost::asio::ip::udp::socket socket(io_service);
struct iwreq wreq
memset(&wreq, 0, sizeof(struct iwreq));
sprintf(wreq.ifr_name, IW_INTERFACE);
id = malloc(IW_ESSID_MAX_SIZE+1);
wreq.u.essid.pointer = id;
boost::asio::detail::io_control::myCommand command;
command.set(&wreq);
boost::system::error_code ec;
socket.io_control(command, ec);
if (ec)
{
// An error occurred.
}
Custom command:
#include <boost/asio/detail/config.hpp>
#include <cstddef>
#include <boost/config.hpp>
#include <boost/asio/detail/socket_types.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
namespace io_control {
// I/O control command for getting number of bytes available.
class myCommand
{
public:
// Default constructor.
myCommand()
: value_(0)
{
}
// Get the name of the IO control command.
int name() const
{
return static_cast<int>(SIOCGIWESSID);
}
// Set the value of the I/O control command.
void set(struct iwreq* value)
{
value_ = static_cast<detail::ioctl_arg_type>(value);
}
// Get the current value of the I/O control command.
std::size_t get() const
{
return static_cast<struct iwreq*>(value_);
}
// Get the address of the command data.
detail::ioctl_arg_type* data()
{
return &value_;
}
// Get the address of the command data.
const detail::ioctl_arg_type* data() const
{
return &value_;
}
private:
detail::ioctl_arg_type value_;
};
} // namespace io_control
} // namespace detail
} // namespace asio
} // namespace boost
However, the code does not work.
If you have any example code or solution, please let me know.
Thank you.

Subclassing QSqlTableModel insert new value

I want to show SQL data from a local db-File in a QML-Tableview and than would like to do some edits to the sql-database.
What I managed to do after about three weeks: Showing my data in a QML-Tableview. I am not sure if I really need to subclass QSqlTableModel and I definitly would be glad if subclassing would not be neccessary at all.
In my main.cpp following should create my model and directly add a record.
// Create an instance of the SqlModel for accessing the data
SqlDataModel *sqlModel;
sqlModel = new SqlDataModel(0,base.database());
sqlModel->setTable("diaBaneDatabase");
sqlModel->setSort(0, Qt::AscendingOrder);
sqlModel->setEditStrategy(QSqlTableModel::OnFieldChange);
sqlModel->select();
QSqlRecord record(sqlModel->record());
record.setValue(0,50);
record.setValue(3,222);
sqlModel->insertRecord(-1, record);
sqlModel->submitAll();
This should add 222 to the 4th column. But nothing will be stored in my sqlDatabase
My SqlDataModel::setData loolks like this:
bool SqlDataModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
qDebug() << index.column() << " " << index.row() << " " << value << " ---- " << role;
qDebug() << roles[Qt::UserRole + 1];
//qDebug() << QSqlTableModel::setData(modelIndex, value);
qDebug() << QSqlQueryModel::setData(index, value);
return false;
}
The output will be:
0 39 QVariant(int, 50) ---- 2
"id"
false
1 39 QVariant(QString, "") ---- 2
"id"
false
2 39 QVariant(QString, "") ---- 2
"id"
false
3 39 QVariant(int, 222) ---- 2
"id"
false
4 39 QVariant(double, 0) ---- 2
"id"
false
5 39 QVariant(int, 0) ---- 2
"id"
false
6 39 QVariant(double, 0) ---- 2
"id"
false
7 39 QVariant(double, 0) ---- 2
"id"
false
For sure my setData method is wrong but I don't understand what should happen there and I didn't find any example for this.
Am I wrong with my assumption that I need to subclass QSqlTableModel to be able to put the model through QQmlContext to QML and than show the columns with roles named like my column-namings? If not how could I put the content of column 1 to QMLTableview:
TableViewColumn {
role: "id" // what should be the role if I don't subclass???
title: "ID"
width: 80
}
I'm happy for any help, comment, example, other posts or whatever brings me further forward ... thanks
I've been working on an example.
Some notes:
QML items such as TableView require a model so I think a QSqlTableModel is a very good option. Of course, you have other models that could be used to handle items of data.
In the class MySqlTableModel you will see the required role names. MySqlTableModel reimplements roleNames() to expose the role names, so that they can be accessed via QML.
You could reimplement the setData method in MySqlTableModel, but I think it is better to use the method insertRecord provided by QSqlTableModel.
I hope this example will help you to fix your errors.
main.cpp
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "mysqltablemodel.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("mydb");
if(!db.open()) {
qDebug() << db.lastError().text();
return 0;
}
QSqlQuery query(db);
if(!query.exec("DROP TABLE IF EXISTS mytable")) {
qDebug() << "create table error: " << query.lastError().text();
return 0;
}
if(!query.exec("CREATE TABLE IF NOT EXISTS mytable \
(id integer primary key autoincrement, name varchar(15), salary integer)")) {
qDebug() << "create table error: " << query.lastError().text();
return 0;
}
MySqlTableModel *model = new MySqlTableModel(0, db);
model->setTable("mytable");
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
model->select();
QSqlRecord rec = model->record();
rec.setValue(1, "peter");
rec.setValue(2, 100);
model->insertRecord(-1, rec);
rec.setValue(1, "luke");
rec.setValue(2, 200);
model->insertRecord(-1, rec);
if(model->submitAll()) {
model->database().commit();
} else {
model->database().rollback();
qDebug() << "database error: " << model->lastError().text();
}
QQmlApplicationEngine engine;
QQmlContext *ctxt = engine.rootContext();
ctxt->setContextProperty("myModel", model);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
mysqltablemodel.h
#ifndef MYSQLTABLEMODEL_H
#define MYSQLTABLEMODEL_H
#include <QSqlTableModel>
#include <QSqlRecord>
#include <QSqlError>
#include <QSqlQuery>
#include <QDebug>
class MySqlTableModel : public QSqlTableModel
{
Q_OBJECT
public:
MySqlTableModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase());
Q_INVOKABLE QVariant data(const QModelIndex &index, int role=Qt::DisplayRole ) const;
Q_INVOKABLE void addItem(const QString &name, const QString &salary);
protected:
QHash<int, QByteArray> roleNames() const;
private:
QHash<int, QByteArray> roles;
};
#endif // MYSQLTABLEMODEL_H
mysqltablemodel.cpp
#include "mysqltablemodel.h"
MySqlTableModel::MySqlTableModel(QObject *parent, QSqlDatabase db): QSqlTableModel(parent, db) {}
QVariant MySqlTableModel::data ( const QModelIndex & index, int role ) const
{
if(index.row() >= rowCount()) {
return QString("");
}
if(role < Qt::UserRole) {
return QSqlQueryModel::data(index, role);
}
else {
return QSqlQueryModel::data(this->index(index.row(), role - Qt::UserRole), Qt::DisplayRole);
}
}
QHash<int, QByteArray> MySqlTableModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[Qt::UserRole + 1] = "name";
roles[Qt::UserRole + 2] = "salary";
return roles;
}
void MySqlTableModel::addItem(const QString &name, const QString &salary)
{
QSqlRecord rec = this->record();
rec.setValue(1, name);
rec.setValue(2, salary.toInt());
this->insertRecord(-1, rec);
if(this->submitAll()) {
this->database().commit();
} else {
this->database().rollback();
qDebug() << "database error: " << this->lastError().text();
}
}
main.qml
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
visible: true
TableView {
id: tableView
anchors.fill: parent
TableViewColumn {
role: "name"
title: "Name"
width: 200
}
TableViewColumn {
role: "salary"
title: "Salary"
width: 200
}
model: myModel
}
Button {
id: addButton
anchors.verticalCenter: parent.verticalCenter
text: "Add item"
onClicked: {
if (nameBox.text || salaryBox.text) {
myModel.addItem(nameBox.text, salaryBox.text)
}
}
}
TextField {
id: nameBox
placeholderText: "name"
anchors.verticalCenter: parent.verticalCenter
anchors.left: addButton.right
anchors.leftMargin: 5
}
TextField {
id: salaryBox
placeholderText: "salary"
anchors.verticalCenter: parent.verticalCenter
anchors.left: nameBox.right
anchors.leftMargin: 5
}
}

Qml define custom property group [duplicate]

This question already has answers here:
How to create grouped/nested properties?
(3 answers)
Closed 7 years ago.
How can I define custom property groups in qml, equal to the anchors property?
Example usage:
Item {
anchors {
leftMargin: 5
rightMargin: 5
}
}
I'm afraid this is not as simple as you are thinking it might be.
As far as I know, you have two options:
1.- Follow the recommendation you will see in the link provided by #BaCaRoZzo and implement your own object type.
2.- Write a more complex QML type in C++ and use it in your QML file. More or less the idea pointed out by #folibis. Example:
main.cpp
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include "customitem.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<CustomItem>("CustomItem", 1,0, "CustomItem");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
customitem.h
#ifndef CUSTOMITEM_H
#define CUSTOMITEM_H
#include <QObject>
class CustomItem: public QObject
{
Q_OBJECT
/*
* Any property that is writable should have an associated NOTIFY signal.
* Ref: http://doc.qt.io/qt-5/qtqml-cppintegration-exposecppattributes.html#exposing-properties
*/
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
public:
CustomItem(QObject *parent = 0);
int x() const;
void setX(int);
int y() const;
void setY(int);
private:
int m_x;
int m_y;
signals:
void xChanged();
void yChanged();
public slots:
};
#endif // CUSTOMITEM_H
customitem.cpp
#include "customitem.h"
CustomItem::CustomItem(QObject *parent)
: QObject(parent), m_x(0), m_y(0)
{
}
int CustomItem::x() const
{
return m_x;
}
void CustomItem::setX(int x)
{
m_x = x;
}
int CustomItem::y() const
{
return m_y;
}
void CustomItem::setY(int y)
{
m_y = y;
}
main.qml
import QtQuick 2.5
import QtQuick.Window 2.2
import CustomItem 1.0
Window {
visible: true
CustomItem {
id: customItem
x: 50
y: 50
}
Rectangle {
id: rect
x: customItem.x
y: customItem.y
width: 100; height: 100
color: "red"
}
}

How to be notified on focus?

This question has been edited:
I am working with QML.
I have a custom type called polygon, which is a subcalss of QDeclarativeItem.
I want to be notified when a mouse clicked on a polygon(has focus).
I know QDeclarativeItem has a function: focusInEvent.
I override it in Polygon.cpp, here is polygon.cpp
#include "polygon.h"
#include "point.h"
#include <QPainter>
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <QGraphicsSceneDragDropEvent>
#include <QFocusEvent>
#include "DeclarativeDragDropEvent.h"
using namespace std;
using namespace Qt;
Polygon::Polygon(QDeclarativeItem *parent)
: QDeclarativeItem(parent)
{
// need to disable this flag to draw inside a QDeclarativeItem
setFlag(QDeclarativeItem::ItemHasNoContents, false);
setFlags(ItemIsSelectable|ItemIsMovable|ItemIsFocusable);
setAcceptDrops(true);
}
QVariant Polygon::itemChange(GraphicsItemChange change, const QVariant &value)
{
return QGraphicsItem::itemChange(change, value);
}
void Polygon::focusInEvent ( QFocusEvent * event ){
cout<<"focusin"<<endl;
}
QRectF Polygon::boundingRect() const{
QVector<QPointF> vPnt=listToVector(m_vertices);
return QPolygonF(vPnt).boundingRect();
}
QPainterPath Polygon::shape () const
{
QPainterPath path;
QVector<QPointF> vPnt=listToVector(m_vertices);
path.addPolygon(QPolygonF(vPnt));
return path;
}
QString Polygon::name() const
{
return m_name;
}
void Polygon::setName(const QString &name)
{
m_name = name;
}
QColor Polygon::color() const
{
return m_color;
}
void Polygon::setColor(const QColor &color)
{
m_color = color;
}
void Polygon::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
QPen pen(m_color, 2);
painter->setPen(pen);
painter->setRenderHints(QPainter::Antialiasing, true);
QVector<QPointF> vPnt=listToVector(m_vertices);
painter->setBrush(QBrush(m_color,Qt::SolidPattern));
painter-> drawPolygon(QPolygonF(vPnt),Qt::OddEvenFill);
}
QVector<QPointF> Polygon:: listToVector(QList<Point *> lpnt) const{
QVector<QPointF> vPnt;
for(int i=0;i<lpnt.length();i++){
vPnt.append(QPointF(lpnt.at(i)->x(),lpnt.at(i)->y()));
}
return vPnt;
}
QDeclarativeListProperty<Point> Polygon::vertices()
{
return QDeclarativeListProperty<Point>(this, 0, &Polygon::append_vertex);
}
void Polygon::append_vertex(QDeclarativeListProperty<Point> *list, Point *vertex)
{
Polygon *polygon = qobject_cast<Polygon *>(list->object);
if (polygon) {
vertex->setParentItem(polygon);
polygon->m_vertices.append(vertex);
}
}
And here is my qml file:
import MyTypes 1.0
import QtQuick 1.0
import Qt 4.7
Item {
id:container
width: 300; height: 200
Polygon {
id: aPolygon
anchors.centerIn: parent
width: 100; height: 100
name: "A simple polygon"
color: "blue"
vertices:[
Point{x:20.0; y:40.0},
Point{x:40.0; y:40.0},
Point{x:40.0; y:20.0},
Point{x:20.0; y:20.0}
]
}
}
i override shape, boundingRect as you can see to define Polygon object and to succeed to be notified when a click, a focus appeared in ti
But i can not see cout output in focusInEvent function on screen.
Should i add something on main.cpp of project?
What to do to C++ code know that the object has focus?
Some connection?
Thanks for any idea.
I tried and it seems the problem is with the output "cout", try the "qDebug" and see that you have good code.
All you did is correct.