Qt India

RSS Feed
A group for the Indian Qt Developer community. To learn, discuss and showcase Qt apps, ask questions, troubleshoot and help each other. All other members are also welcome to join.
Founder: Deleted Member # 4a2
Members: 689
Category: Regional
Join group

This is an overview of the latest updated topics, visit the full forum here.

3
replies

Beginner

by: sarabjot10 | Views: 95 | Forum: India | Last post by Andre, January 26, 2015

Guys i am new to QT…how to start? i want to develop a chatting application…

5
replies

Unable to add library to the .pro file of the target file

by: binnet | Views: 180 | Forum: India | Last post by sierdzio, January 23, 2015

I have created a shared library in Qt 5.0.2 called “something”. Now, 4 files have been created (something.pro,something.h,something_global.h and something.cpp).
I want to use this library in another project called “trial”. How to use the library “something” in “trial”?

Please help me as I am new to Qt as well as Linux(Fedora 16).
I know that I should use
LIBS += [path to library files]
INCLUDEPATH+= [path to header files]

I am unable find the library file (something.so).
Will “something.so” be auto generated if I have created the library?—

1
replies

Downloading data ZIP file from website

by: rambabuy | Views: 130 | Forum: India | Last post by sierdzio, January 13, 2015

Hi Experts ,

I am downloading data from www.nseinda.com
and the link is “http://www.nseindia.com/content/historical/EQUITIES/2015/JAN/cm12JAN2015bhav.csv.zip”

But i am downloading 0 size file ..

anything wrong ? or any working program for downloading files from web?

@downloader::downloader(QObject *parent) : QObject(parent)
{ qDebug() << FILE<<” : “ << FUNCTION << “ Entering”; myprocedure(); qDebug() << FILE<<” : “ << FUNCTION << “ Leaving”;
}

void downloader::downloadFile(const QString &url, const QString &aPathInClient)
{ qDebug() << FILE<<” : “ << FUNCTION << “ Entering”; QNetworkAccessManager m_NetworkMngr; QNetworkReply *reply= m_NetworkMngr.get(QNetworkRequest(url)); QEventLoop loop; QObject::connect(reply, SIGNAL),&loop, SLOT)); loop.exec(); QUrl aUrl(url); QFileInfo fileInfo=aUrl.path();

QFile file(aPathInClient+”\\”+fileInfo.fileName()); file.open(QIODevice::WriteOnly); file.write(reply->readAll()); delete reply; qDebug() << FILE<<” : “ << FUNCTION << “ Leaving”;

}
void downloader::myprocedure()
{ qDebug() << FILE<<” : “ << FUNCTION << “ Entering”;

QString path; QString localpath; QMessageBox msgBox; QMessageBox msgBox2; path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); path = “C:/Users/ryerajan/build-untitled2-Desktop_Qt_5_3_MinGW_32bit-Debug/base/download/cm01OCT2014bhav.dbf.zip”; localpath = path; // QMessageBox msgBox2; msgBox2.setText(“You can download the update from the web.”); msgBox2.setInformativeText(“Do you want to download the file now?”); msgBox2.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox2.setDefaultButton(QMessageBox::Yes); int ret = msgBox2.exec(); if (ret == QMessageBox::Yes) { downloadFile [...]
0
replies

Qt::TapGesture Gesture is not working properly

by: Akhil. V . S | Views: 155 | Forum: India

I have created a custom gesture as,

  1. Gesture*
  2. CustomTapGestures::create(QObject* pTarget)
  3. {
  4.    QGesture *Gesture = new QTapGesture(pTarget);
  5.    return Gesture;
  6. }
  7.  
  8. QGestureRecognizer::Result
  9. CustomTapGestures::recognize(QGesture* Gesture, QObject *Object, QEvent *event)
  10. {
  11.    QGestureRecognizer::Result result = QGestureRecognizer::Ignore;
  12.  
  13.    return result;
  14. }
  15.  
  16. void
  17. CustomTapGestures::reset(QGesture *Gesture)
  18. {
  19.    Gesture->setProperty("startPoint", QVariant(QVariant::Invalid));
  20.    parent::reset(Gesture);
  21. }

and I am using that in my event class as

  1. Screen::Screen(Desktop *Dk)
  2. {
  3.     QVBoxLayout *screenLayout = new QVBoxLayout ;
  4.     screenLayout->addWidget(Dk);
  5.     setLayout(screenLayout);
  6.     QGestureRecognizer* CTap = new CustomTapGestures ;
  7.     Qt::GestureType CTapId = QGestureRecognizer::registerRecognizer(CTap) ;  ;
  8.  
  9.     grabGesture(CTapId);
  10. }
  11.  
  12. bool Screen::event(QEvent *event)
  13. {
  14.     event->accept();
  15.      if (event->type() == QEvent::Gesture)
  16.          return gestureEvent(static_cast<QGestureEvent*>(event));
  17.      return QWidget::event(event);
  18. }
  19.  
  20.  
  21. bool Screen::gestureEvent(QGestureEvent *event)
  22. {
  23.     if (QGesture *tap = event->gesture(Qt::TapGesture))
  24.         ontapTriggered(static_cast<QTapGesture *>(tap));
  25.     return true;
  26. }
  27.  
  28. void Screen::ontapTriggered(QTapGesture *gesture)
  29. {
  30.     if( gesture->state() == Qt::GestureFinished )
  31.         qDebug() << "working QTapGesture" ;
  32. }

Here Desktop *Dk is a normal widget having size 1280×640, and when tap on screen it is giving output as working tapgesture even if in my tap recognize am disabled it whatever be the event.. ( i am testing this because for a certain condition I want to disable the tap) please give me a solution Thanks in advace

2
replies

How to use Hunspell in Qt.

by: Vikas A | Views: 269 | Forum: India | Last post by Vikas A, December 16, 2014

I am working on Windows 7 (Qt with MinGW ), i want to user Hunspell in my project.
It is very complicated to use it in windows environment.

Please some one can provide a like to any document (not Hunspell standard documents) or any other help.
Thanks,

10
replies

how to take input date from user in qdateedit and show database accordingly

by: vikchh00@gmail.com | Views: 818 | Forum: India | Last post by p3c0, December 6, 2014

how to take input any date from user in qdateedit or calenderwidget and show database accordingly by clicking button now my code is showing databse of only current date(todays date) i want user to selct date and show data of that particular date

  1. void MainWindow::on_pushButton_2_clicked()
  2. {
  3.     QCalendarWidget *calendar=new QCalendarWidget;
  4.     QDateEdit *dateedit=new QDateEdit;
  5.  
  6.  
  7.     QDate d=calendar->selectedDate();
  8.     ui->dateEdit->setDate(d);
  9.  
  10.  
  11.     int  q= d.year();
  12.     QString q1=QString::number(q);
  13.     int q2=d.month();
  14.     QString q3=QString::number(q2);
  15.     int q4=d.day();
  16.     QString q5=QString::number(q4);
  17.  
  18.     QSqlQueryModel *mode =new QSqlQueryModel(ui->print);
  19.     mode->setQuery(QString("select * from health10  where month(Datestamp)=\""+q3+"\" and day(Datestamp)=\""+q5+"\" and year(datestamp)=\""+q1+"\" ;"));
  20.     ui->print->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
  21.     ui->print->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
  22.     ui->print-> setModel (mode);

[edit: added missing coding tags @ SGaist]

0
replies

problem about QHistoryState

by: tcsjzdnlh | Views: 184 | Forum: India

  1.  QHistoryState *s1h = new QHistoryState(s1);
  2.  
  3.     QState *s3 = new QState();
  4.     s3->assignProperty(label, "text", "In s3");
  5.     QMessageBox *mbox = new QMessageBox(mainWindow);
  6.     mbox->addButton(QMessageBox::Ok);
  7.     mbox->setText("Interrupted!");
  8.     mbox->setIcon(QMessageBox::Information);
  9.     QObject::connect(s3, SIGNAL(entered()), mbox, SLOT(exec()));
  10.     s3->addTransition(s1h);
  11.     machine.addState(s3);
  12.  
  13.     s1->addTransition(interruptButton, SIGNAL(clicked()), s3);

//——————

this snippet from Qt document about QHistoryState

i wonder to know one of statements : s3->addTransition(s1h);

how the s3 state transition to s1h (QHistoryState) without signal or event,
it should be some thing like that: s3->addTransition( button, SIGNAL, s1h) );

1
replies

Serial comunicacion using Qt and Visual Studio

by: Falcon2050 | Views: 321 | Forum: India | Last post by tarod.net, November 12, 2014

Hello :
I would like to ask you very kindly about how to realize a serial communication using Qt and Visual Studio.
Here is the code I have up to now :

//mytimer.hpp

  1. #ifndef MYTIMER_HPP
  2. #define MYTIMER_HPP
  3.  
  4. #include <QtSerialPort/QtSerialPort>
  5. #include <QTimer>
  6. #include <QThread>
  7. #include <QObject>
  8.  
  9. class MyTimer : public QObject
  10. {
  11.  Q_OBJECT
  12.  
  13. public:
  14.  MyTimer(int,int);
  15.  QSerialPort serial;
  16.  QTimer timer;                        
  17.  int how_many_times;
  18.  int sampling;
  19.  
  20.  
  21. signals:              
  22.  void done();
  23.  
  24. public slots:
  25.  void MyTimerSlot();
  26. };
  27.  
  28. #endif // MYTIMER_H

//mytimer.cpp

  1. //#include <QtSerialPort/QtSerialPort>
  2. #include "mytimer.hpp"
  3. #include <QDebug>
  4.  
  5.  
  6.  
  7. MyTimer::MyTimer(int a, int b)
  8. {
  9.  how_many_times = a;
  10.  sampling = b;
  11.  
  12.     connect(&timer, SIGNAL(timeout()),
  13.   this, SLOT(MyTimerSlot()));
  14.  
  15.  timer.setInterval(sampling);
  16.  timer.start();                
  17.  
  18. }
  19.  
  20. void MyTimer::MyTimerSlot()
  21. {
  22.  
  23.  if (how_many_times == 1)
  24.  {
  25.   timer.stop();
  26.  }
  27.  
  28.  /*==========================================================================*/
  29.  
  30.  
  31.  serial.setPortName("COM1");
  32.  serial.setBaudRate(QSerialPort::Baud9600);
  33.  serial.setDataBits(QSerialPort::Data8);
  34.  serial.setParity(QSerialPort::NoParity);
  35.  serial.setStopBits(QSerialPort::OneStop);
  36.  serial.setFlowControl(QSerialPort::NoFlowControl);
  37.  serial.open(QIODevice::ReadWrite);
  38.  
  39.  serial.write("hello");
  40.  
  41.  serial.close();
  42.  
  43.  /*==========================================================================*/
  44.  
  45.  qDebug() << "hello" ;
  46.  
  47.  how_many_times -= 1;
  48.  
  49.  if (how_many_times == 0)
  50.  {
  51.   done();
  52.  }
  53.  
  54.  
  55. }

//main.cpp

  1. #include <QCoreApplication>
  2. #include "mytimer.hpp"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.  QCoreApplication a(argc, argv);
  7.  
  8.  MyTimer timer(20,500);
  9.  
  10.  QObject::connect(&timer, SIGNAL(done()), &a, SLOT(quit()));
  11.  
  12.  return a.exec();
  13. }

Thank you in advance for your response,
Have a nice day!

[edit: added missing coding tags @ SGaist]

0
replies

installation of Qt creator on red hat linux

by: jatinjanshali | Views: 320 | Forum: India

I need a help to install qt creator <qt-creator-opensource-linux-x86_64-3.2.1.run > on red hat linux <2.6.32-71.el6.x86_64>. qt creator is successfully installed but when i start the qt creator following error is coming:
(<unknown>:9851): Gtk-WARNING **: Attempt to load unknown IM context type ‘gtk-im-context-none’
Failed to load core: /home/jatin/qtcreator-3.2/lib/qtcreator/plugins/libCore.so: Cannot load library /home/jatin/qtcreator-3.2/lib/qtcreator/plugins/libCore.so: (/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14’ not found (required by /home/jatin/qtcreator-3.2/lib/qtcreator/plugins/libCore.so))

help me

2
replies

I need help on taking a flash webvideo screenshot on Pyside or PyQt4

by: rasheedahmed27 | Views: 391 | Forum: India | Last post by rasheedahmed27, October 16, 2014

i have an issue on taking a screenshot of the youtube video page.

in Pyside i have enabled flash function using below command to play video on Pyside browser

  1.     s.setAttribute(QWebSettings.PluginsEnabled, True)
  2.     s.setAttribute(QWebSettings.JavascriptEnabled, True)

now my script can open video embedded website and playing videos but when i tried to capture screenshot it showing Black screen on video embedded place.

Script:

#!/usr/bin/env python
#-*- coding:utf-8 *

@from PySide.QtCore import Qt, QUrl, QTimer, Slot
from PySide.QtGui import QApplication, QImage, QPainter
from PySide.QtWebKit import QWebView, QWebPage, QWebSettings
from PySide.QtNetwork import QNetworkRequest, QNetworkReply
import time, sys

class Render(QWebView): def init(self, url, filename, image_crop, translate_page, parent=None): super(Render, self).init(parent) self.image_crop = image_crop self.fileName = time.strftime(”%Y%m%d%H%M%S”,time.localtime()) +”_test.jpg” self.finished = False

# Settings s = self.page().settings() s.setAttribute(QWebSettings.AutoLoadImages, True) s.setAttribute(QWebSettings.PluginsEnabled, True) s.setAttribute(QWebSettings.JavascriptEnabled, True) s.setAttribute(QWebSettings.JavaEnabled, False) s.setAttribute(QWebSettings.JavascriptCanOpenWindows, False) s.setAttribute(QWebSettings.DeveloperExtrasEnabled, True) #self.page().mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) self.page().mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) self.timerScreen = QTimer() self.timerScreen.setInterval(10000) self.timerScreen.setSingleShot(True) self.timerScreen.timeout.connect(self.takeScreenshot) self.loadFinished.connect(self.timerScreen.start) self.load(QUrl(url)) @Slot(QNetworkReply) def takeScreenshot(self): [...]

This is an overview of the latest updated topics, visit the full forum here.