Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

undefined reference to `bb::device::DisplayInfo::DisplayInfo(QObject*)'

/*
 * Copyright (c) 2011-2013 BlackBerry Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "applicationui.hpp"
#include "homepage.hpp"
#include "timer.hpp"
#include <bb/device/DisplayInfo>
#include <bb/cascades/Application>
#include <bb/cascades/DropDown>
#include <bb/cascades/Label>
#include <bb/cascades/CheckBox>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/LocaleHandler>
#include <bb/cascades/NavigationPane>
#include <bb/cascades/NavigationPaneProperties>
#include <bb/cascades/Page>

using namespace bb::cascades;
using namespace bb::device;
AbstractPane *root;
static NavigationPane* myNavi;
bb::cascades::Application *app2;
NavigationPane* ApplicationUI::myNavi;
int selIndex = -1;
ApplicationUI::ApplicationUI() :
        QObject()
{
	//app2  = app;
	QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);

}

void ApplicationUI::onSystemLanguageChanged()
{
    QCoreApplication::instance()->removeTranslator(m_pTranslator);
    // Initiate, load and install the application translation files.
    QString locale_string = QLocale().name();
    QString file_name = QString("Test1_%1").arg(locale_string);
    if (m_pTranslator->load(file_name, "app/native/qm")) {
        QCoreApplication::instance()->installTranslator(m_pTranslator);
    }
}
void ApplicationUI::clickedButton()
{
//	myNavi = root->findChild<NavigationPane*>("myNavi");
	QSettings settings("MySoft", "Star Runner");
	CheckBox* check = root->findChild<CheckBox*>("remember");
	if(check->isChecked())
	{
		DropDown *dropDown1= root->findChild<DropDown*>("dropList");
			selIndex = dropDown1->selectedIndex();
		  qDebug() << "checked" << selIndex;
		settings.setValue("jack",selIndex);
	}
	else
	{
		 qDebug() << "unchecked 0000 " << selIndex;
		settings.setValue("jack",0);
	}
	HomePage *home = new HomePage(app2);

}
void ApplicationUI::init()
{
	 qDebug() << "before splah over function calls";
		    QSettings settings("MySoft", "Star Runner");
		    int m = settings.value("jack").toInt();
		    qDebug() << "before splah over function calls" << m;
		   selIndex = m;
	    qmlRegisterType<Timer>("com.devpda.tools", 1, 0, "MyTimer");
	    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

	    // Create root object for the UI
	    root = qml->createRootObject<AbstractPane>();
	    if (!qml->hasErrors()) {
	                qDebug() << "casting and storing NavigationPane";
	                myNavi = dynamic_cast<NavigationPane*>(root);
	                qml->setContextProperty("quoteApp", this);
	            }
;

	    DisplayInfo display;
	    int width = display.pixelSize().width();
	    int height = display.pixelSize().height();

	    QDeclarativePropertyMap* displayProperties = new QDeclarativePropertyMap;
	    displayProperties->insert("width", QVariant(width));
	    displayProperties->insert("height", QVariant(height));
	    qml->setContextProperty("DisplayInfo", displayProperties);
	    Application::instance()->setScene(root);
}

int ApplicationUI::getIndex()
{
	return selIndex;
}
float ApplicationUI::getWidth()
{
	Label* lb = root->findChild<Label*>("dropLabel");
	qDebug() << "casting and storing NavigationPane";
	return 400.0;

}

 

 

why is that? i get error like that?>

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: undefined reference to `bb::device::DisplayInfo::DisplayInfo(QObject*)'

solved by adding this my .pro file

LIBS += -lbbdevice