[Interest] QTableView
Hi All QtableView display sql table. But I want to merge data of two columns in sql table to one column in QtableView. Eg: Sql table: 1 2 3 4 5 6 Aabb cc dd ee ff Gghh ii jj kk ll QtableView 1 23 Aabb ccdd eeff Gghh iijj kkll I want to design a Sql Model for QtableView,but I don’t know how to do it! Anybody has good idea? Thanks Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] QTableWidget add chart
Hi all I want to add a widget to QtableWidget.(like excel, insert a pie), The widget paint a pie, and I want to insert it to QtableWidget. Does anybody have good idea? Thanks Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] 答复: ´ð¸´: how to block run function of QRunnable class
Hi, Yes, you method works perfectly too. But, if Run class derived from Qrunnable and Qthread, is there any problem? Or is there any potential risk? Thanks Ken 发件人: interest-bounces+pengliang=founder@qt-project.org [mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Tony Rietwyk 发送时间: 2013年3月19日 14:10 收件人: interest@qt-project.org 主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class Hi Ken, Sorry for the confusion - deriving from both QRunnable and QThread is probably NOT a good idea - you don't want to create your own QThread - just access the static methods: // Hack to get around Qt strictness... class TSleepThread: public QThread { public: static void sleep(unsigned long secs) { QThread::sleep(secs); }; static void msleep(unsigned long msecs) { QThread::msleep(msecs); }; static void usleep(unsigned long usecs) { QThread::usleep(usecs); }; }; then in your QRunnable derived class: ... TSleepThread::msleep( 20 ); ... Regards, Tony From: pengliang(??) [mailto:pengli...@founder.com] Sent: Tuesday, 19 March 2013 4:46 PM To: Tony Rietwyk; interest@qt-project.org Subject: ??: [Interest]´ð¸´: how to block run function of QRunnable class Hi I have defined a class derived from Qrunnable and Qthread. Now, i call sleep in run function, it worked perfect. Thanks Ken 发件人: interest-bounces+pengliang=founder@qt-project.org [mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Tony Rietwyk 发送时间: 2013年3月19日 13:36 收件人: interest@qt-project.org 主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class Hi Ken, In Qt 4, you have to define your own override of QThread and expose the protected static sleep methods. I'm don't know about Qt 5. Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of pengliang(??) Sent: Tuesday, 19 March 2013 4:22 PM To: Amogh Kudari Cc: Interest@qt-project.org Subject: [Interest] 答复: how to block run function of QRunnable class Hi Thank you. But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread. Thanks Ken 发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 发送时间: 2013年3月19日 11:53 收件人: pengliang(彭亮) 抄送: Interest@qt-project.org 主题: Re: [Interest] how to block run function of QRunnable class Hi Pengliang, I am not pretty sure but it may be possible as QThreadPoolThread is a friend class of Qrunnable class and QThreadPoolThread is derived from QThread and QThread has the sleep method. Hope this helps. Regards, Amogh. On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote: Hi all I don’t know how to block run function several seconds of Qrunnable class. Andybody know? Thanks Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] how to block run function of QRunnable class
Hi all I don’t know how to block run function several seconds of Qrunnable class. Andybody know? Thanks Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] 答复: how to block run function of QRunnable class
Hi Thank you. But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread. Thanks Ken 发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 发送时间: 2013年3月19日 11:53 收件人: pengliang(彭亮) 抄送: Interest@qt-project.org 主题: Re: [Interest] how to block run function of QRunnable class Hi Pengliang, I am not pretty sure but it may be possible as QThreadPoolThread is a friend class of Qrunnable class and QThreadPoolThread is derived from QThread and QThread has the sleep method. Hope this helps. Regards, Amogh. On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote: Hi all I don’t know how to block run function several seconds of Qrunnable class. Andybody know? Thanks Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] 答复: 答复: how to block run function of QRunnable class
Hi I am sorry, I use Qt4. So, anybody know? Thanks Ken 发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 发送时间: 2013年3月19日 13:31 收件人: pengliang(彭亮) 抄送: Interest@qt-project.org 主题: Re: 答复: [Interest] how to block run function of QRunnable class Hi Pengliang, It's not QthreadPool I referred to. Its QThreadPoolThread which is derived from QThread. I am referring QT5.0. //QThreadpool.cpp /* QThread wrapper, provides synchronizitaion against a ThreadPool */ class QThreadPoolThread : public QThread { public: QThreadPoolThread(QThreadPoolPrivate *manager); void run(); void registerTheadInactive(); QThreadPoolPrivate *manager; QRunnable *runnable; }; and //QThread.h class Q_CORE_EXPORT QThread : public QObject { public: // default argument causes thread to block indefinetely bool wait(unsigned long time = ULONG_MAX); static void sleep(unsigned long); static void msleep(unsigned long); static void usleep(unsigned long); }; Hope this helps. Regards, Amogh. On Tue, Mar 19, 2013 at 10:52 AM, pengliang(彭亮) pengli...@founder.com wrote: Hi Thank you. But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread. Thanks Ken 发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 发送时间: 2013年3月19日 11:53 收件人: pengliang(彭亮) 抄送: Interest@qt-project.org 主题: Re: [Interest] how to block run function of QRunnable class Hi Pengliang, I am not pretty sure but it may be possible as QThreadPoolThread is a friend class of Qrunnable class and QThreadPoolThread is derived from QThread and QThread has the sleep method. Hope this helps. Regards, Amogh. On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote: Hi all I don’t know how to block run function several seconds of Qrunnable class. Andybody know? Thanks Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] 答复: ´ð¸´: how to block run function of QRunnable class
Hi I have defined a class derived from Qrunnable and Qthread. Now, i call sleep in run function, it worked perfect. Thanks Ken 发件人: interest-bounces+pengliang=founder@qt-project.org [mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Tony Rietwyk 发送时间: 2013年3月19日 13:36 收件人: interest@qt-project.org 主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class Hi Ken, In Qt 4, you have to define your own override of QThread and expose the protected static sleep methods. I'm don't know about Qt 5. Tony From: interest-bounces+tony=rightsoft.com...@qt-project.org [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of pengliang(??) Sent: Tuesday, 19 March 2013 4:22 PM To: Amogh Kudari Cc: Interest@qt-project.org Subject: [Interest] 答复: how to block run function of QRunnable class Hi Thank you. But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread. Thanks Ken 发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 发送时间: 2013年3月19日 11:53 收件人: pengliang(彭亮) 抄送: Interest@qt-project.org 主题: Re: [Interest] how to block run function of QRunnable class Hi Pengliang, I am not pretty sure but it may be possible as QThreadPoolThread is a friend class of Qrunnable class and QThreadPoolThread is derived from QThread and QThread has the sleep method. Hope this helps. Regards, Amogh. On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote: Hi all I don’t know how to block run function several seconds of Qrunnable class. Andybody know? Thanks Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] 答复: moveToThread and object deletion
Yes, Api doc says: Warning: This function is dangerous and its use is discouraged. The thread can be terminated at any point in its code path. Threads can be terminated while modifying data. There is no chance for the thread to clean up after itself, unlock any held mutexes, etc. In short, use this function only if absolutely necessary. -邮件原件- 发件人: interest-bounces+pengliang=founder@qt-project.org [mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Thiago Macieira 发送时间: 2013年3月15日 1:51 收件人: interest@qt-project.org 主题: Re: [Interest] moveToThread and object deletion On quinta-feira, 14 de março de 2013 18.33.38, Etienne Sandré-Chardonnal wrote: Is it safe and correct to connect QThread::quit() and QThread::terminated() to Worker::deleteLater() ? I would say no, as signal/slot mechanism will try to run deleteLater() in the workerThread, which is not running anymore, so object deletion will never happen. That's actually very good thinking, showing you understand how threads work. But we added a little bit of magic to the event dispatcher: after the finished() signal is emitted, it runs all events once again to process object deletions. You couldn't have known that by simple analysis. In other words, you can connect finished() to deleteLater() and it will work. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] connect sql server via odbc
Hi everyone. I connected MSSQL (on windows) via odbc on linux redhat 64bit. I executed sql command via isql or tsql(unixODBC) is perfect, but it always fail. So, maybe DSN string problem? Could anybody help me? Thanks Ken Below is odbc and freetds configuration files. ---freetds.conf: [FreeTDS] host=172.21.32.20 port=1433 tds version=7.2 client charset = GB2312 -odbcinst.ini [TDS] Description = TDS Driver = /usr/local/lib/libtdsodbc.so Trace = Yes TraceFile=/tmp/odbcinst.log UsageCount = 1 odbc.ini: [SQLSERVER] Driver = TDS Description = sql server dsn Trace = NO Server = 172.21.32.20 Database = Live Port = 1433 TDS_Version = 7.2 TraceFile=/tmp/sqlserver.log --Snippets: QString f3ErpDsn = QString::fromLocal8Bit(Driver={SQLSERVER};server=172.21.32.20;database=Live;uid=inp;pwd=inp;); QSqlDatabase f3ErpDb= QSqlDatabase::addDatabase(QODBC); f3ErpDb.setDatabaseName(f3ErpDsn); // f3ErpDb.setDatabaseName(SQLSERVER); f3ErpDb.setUserName(inp); f3ErpDb.setPassword(inp); QString sqlCmdStr = select * from dbo.Table_Drilling_Data01 where status=1; if ( ! f3ErpDb.open() ) { qDebug() f3ErpDb.lastError().text(); return 1; } QSqlTableModel model; model.setTable(dbo.Table_Drilling_Data01); model.setFilter(status=3); model.select(); qDebug() model.lastError().text(); --Error messages: f3ErpDb.setDatabaseName(f3ErpDsn); 1. If setDatabaseName is f3ErpDsn error message is: QODBC3: Unable to connect, [unixODBC][Driver Manager]Data source name not found, and no default driver specified) I had defined SQLSERVER in odbc.ini. Why it said can not find it? 2. But if I changed f3ErpDb.setDatabaseName(SQLSERVER);, error message is: [FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (): Data type 0x00 is unknown. QODBC3: Unable to execute statement ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] [Development] important:qt connect mssql on linux
Hi list, I have compiled libqsqlodbc.so on redhat64bit successfully. When I run the snippets bellow some error message occurred. QString Dsn = QString::fromLocal8Bit(Driver={sql server};server=172.2.2.2;database=Live;uid=an;pwd=an;); QSqlDatabase::addDatabase(QODBC); Error msg: QSqlError(0, QODBC3: Unable to connect, [unixODBC][Driver Manager]Data source name not found, and no default driver specified) But I found QODBC is available driver: QSQLITE QMYSQL3 QMYSQL QODBC3 QODBC Could anybody tell me why? 1. I found /etc/odbc.ini is empty, and /home/dd/.odbc.ini does not exist. Is this clue useful? Thanks a lot Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
[Interest] [Qt-interest] important:qt connect mssql on linux
Hi list, I have compiled libqsqlodbc.so on redhat64bit successfully. When I run the snippets bellow some error message occurred. QString Dsn = QString::fromLocal8Bit(Driver={sql server};server=172.2.2.2;database=Live;uid=an;pwd=an;); QSqlDatabase::addDatabase(QODBC); Error msg: QSqlError(0, QODBC3: Unable to connect, [unixODBC][Driver Manager]Data source name not found, and no default driver specified) But I found QODBC is available driver: QSQLITE QMYSQL3 QMYSQL QODBC3 QODBC Could anybody tell me why? 1. I found /etc/odbc.ini is empty, and /home/dd/.odbc.ini does not exist. Is this clue useful? Thanks a lot Ken ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest