- 博客(18)
- 资源 (1)
- 收藏
- 关注
原创 Qt5.9.1 QDoubleValidator 直接构建失效的解决办法
QIntValidator和QDoubleValidator都是用于限制Qt下输入组件输入的类,对于整形数一般使用QIntValidator就可以了,但是根据文档,QIntValidator的范围只能从-2147483647到2147483647。当我需要限制比较打的输入,比如电话号码等等时,就必须使用QDoubleValidator了,但是如果只是将代码中的QIntValidator替换为Q
2017-10-31 14:06:40
2493
原创 Qt5.9.1 Windows下QPlainTextEdit无法正常垂直填充QFormLayout的问题
使用Qt designer将QPlainTextEdit放在QFormLayout里的时候发现垂直向不能正确resize到QFormLayout的问题。解决办法为调整QPlainTextEdit的size policy: //让notePlainTextEdit 垂直填充 Form Layout QSizePolicy policy = ui->notePlainTextEd
2017-10-30 12:08:44
545
转载 {LeetCode} 458. Poor Pigs
There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15 minutes. What is the minimum
2017-03-30 15:32:32
580
原创 {LeetCode} 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use thesame
2017-03-27 16:56:32
336
原创 {LeetCode} 479. Largest Palindrome Product
自己写的代码,没过AC,原因是Submission Result: Time Limit Exceededclass Solution {public: int largestPalindrome(int n) { double max = 0; for (int i=0; i<n; i++) { max
2017-03-22 17:15:14
2218
原创 {LeetCode} 457. Circular Array Loop
##此问题 Test Case并不完全,暂时AC。You are given an array of positive and negative integers. If a number n at an index is positive, then move forward n steps. Conversely, if it's negative (-n), move bac
2017-03-22 11:01:59
881
原创 {LeetCode} 540. Single Element in a Sorted Array
Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once.Example 1:Input: [
2017-03-21 11:51:17
300
原创 {LeetCode} 518. CoinChange2
问题:You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may assume that you have infinit
2017-03-16 14:50:26
908
原创 Xmos驱动win10无法使用的问题
刚刚将系统更新至Win10,一切如初就是Xmos的驱动无法使用和识别器材。首先把之前的Xmos驱动卸载,然后点击电脑开始菜单,设置,更新和安全,恢复,高级启动下的立即重启,然后重启完了到一个设置界面。(没进系统)疑难解答,高级选项,启动设置,重启,重启以后按数字7(不用一直按,等list出现),禁用驱动程序强制签名,然后以管理员身份运行官网官网驱动安装程序就可以了。ASIO和D
2015-12-31 11:21:00
15348
2
原创 QT使用默认浏览器打开网页
并不是使用Qt来开发浏览器,而是用Qt来打开默认的浏览器代码很简单:#include QString URL = "www.baidu.com";QDesktopServices::openUrl(QUrl(URL.toLatin1()));只需要在需要地方加入代码就可以
2015-12-22 16:23:13
5886
1
原创 JAVA开发微信企业号的一些代码片
因为已经改用用C++写了,java的实现也比较简单,贴下来:package com;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.net.URL;import javax.net.ssl.HttpsURLConnection;import net.s
2015-12-07 15:44:04
1921
原创 QNetworkAccessManager不使用信号/槽机制来获得QNetworkReply的解决办法
正在做一个第三方微信企业要接口的项目,JAVA的实现方法比较简单,网上资料也很多。但是我需要在C++下实现,微信企业号接口大多都是https的GET/POST方法实现的。Qt提供了一个封装好的类QNetworkAccessManager,就不需要使用windows的套接字来编程了,也脱离的平台限制。上图是我从http://blog.youkuaiyun.com/chenlong12580/ar
2015-12-04 09:25:36
9678
1
原创 QTableWidget为一列数据排序,整形数据排序 #Qt Creator
问题:TableWidget有自己的Sort函数,setSortingEnabled()可以让表头被点击的时候自动sort当前的列的数据,但是如果数据是以QString储存的话在Sort数字时就出现了问题,比如说100会出现在20之前,因为它的第一位是1比2小==============================================================
2015-11-06 14:23:48
8488
原创 QListWidget动态刷新的问题和解决 #Qt Creator
问题:我想做一个ListWidget,放置一些ListWidgetItem为ip地址和端口号,然后点击一个按键去开始检查每个item的地址能否连接。在检查的同时,给能连接的Item的字体颜色设为绿色,将不能连接的设红色。但是这一系列的操作都是封在一个槽函数当中的,导致点击的结果是等待一段时间,然后整个ListWidget的颜色一起发生变化。而不是随着检查一点一点动态的发生变化。
2015-11-06 14:06:02
10400
1
原创 QProgressDialog使用时不显示的可能问题 #Qt #C++
QProgressDialong是Qt提供的用于显示各类耗时较长的操作进度,而不至于让程序看上去假死了一样,他继承自QDialog。example:http://doc.qt.io/qt-4.8/qprogressdialog.html#labelText-prop但是在测试中会出现Dialog不显示,程序依旧进入假死状态,在网上也查阅不到问题所在。不显示的原因是QProgress
2015-10-30 16:24:45
4189
原创 Qt4.8 使用SLOT/SIGNAL函数传递变量进Dialog #Qt
一般情况下都是使用dialog后,结果用信号传回父窗口。这次是将数据传递近dialog操作,考虑模态和非模态情况,原理是一样的。SIGNAL部分:header 先声明一个信号signals: void info_sender(QString,QString,QString);SLOT部分:也是先声明一个槽函数private slots: void info_
2015-10-24 18:47:42
896
转载 简单的Modbus/TCP客户端,包含写寄存器函数#C++
modbus-TCP 协议文档:http://wenku.baidu.com/link?url=ImagoC3DE1p0D55S7qbzXrSaQ4wbaY93gB3kEmPiHx_CnnNsrdkz1vYA93uTBtvmbzxhRrcBoPc8YNl9UqJqlRAV1r3Tm2tYoOfdTU1zcVG简单来说就是吧modbus RTU的报文做修改后使用TCP协议传输,通常modbu
2015-10-21 13:53:08
14259
5
原创 初次使用Qt Creater网络编程,出现error: undefined reference to `_imp__WSAStartup@8'
在VS中测试完好的modbusTCP发报端/客户端,拿到Qt当中做UI,build时出现error: undefined reference to `_imp__WSAStartup@8'等大约10条error,原因是socket库的编译链接问题。网上的解决办法:错误原因:因为没有联接socket库ws2_32.lib。解决办法:对于VC6.0要在porject/set
2015-10-20 15:27:37
10641
微信公众号开发wechatSampele
2015-12-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人