Posts
All the articles I've posted.
javascript原型和继承
Published: at 02:51 PM对象和类 javascript到处都是对象,一个对象是由方法和属性(值)组成的实体(这里我们叫实例)。例如:javascript中的数组就是一个具有值的对象,同时也包括了push,reverse和pop等方法。 var aArray = 1, 2, 3; aArray.push(3); aArray.reverse(); aArray.pop(); var...
qDebug日志写入本地文件
Published: at 02:11 AM在Qt中使用qDebug打印日志信息是非常方便的,它可以直接打印Qt提供的复杂数据结构,如QStringList,QVariantMap等。不做处理的话它只能在编辑器中打印调试信息,下面介绍将日志信息写入文件的实现方法。 static struct LogWrap { LogWrapLogWrap() { reset(); } ...
javascript怎么实现类似如C++函数中使用静态数据
Published: at 01:02 PM静态数据是一些不变的数据可以多次使用而不用频繁创建,C++中通常把他们放在cpp文件的include下面,或者如果其他地方不会用到的话可以直接写在要用到的函数里面。如果是javascript的话把它直接写在函数外面就是全局变量了这个肯定是不好的,放在函数里面每次运行函数的时候都...
QLayout Attempting to add QLayout
Published: at 03:58 PMQLayout Attempting to add QLayout , which already has a layout 出现这个警告的原因是一个QWidget作为了多个QLayout的parent,一个QWidget应该只有一个main layout,将其它子widget或者layout增加到main layout中,如下代码: QWidget x = new QWidget(this);...
C++11 thread
Published: at 11:22 AMwindows系统中,需要vs2012才支持。 线程的创建 C++11线程类stdthread,头文件include <thread> 首先,看一个最简单的例子: void mythread() { puts("hello, world"); } int main(int argc, char argv) { stdthread t(mythr...
给QPushButton增加图标并且显示在文本右边
Published: at 01:10 AMmbutton = new QPushButton(this); mbutton->setText(tr("Ope34543r")); mbutton->setIcon(QIcon("F\\qt\\OperWidget\\test.png")); mbutton->setLayoutDirection(QtRightToLeft); ...
QLabel文本超出显示区域显示...
Published: at 01:07 AM这个功能很有用,默认情况下文本超出长度会被直接截断的,给用户体验很不好。这里截断后会显示...,并且鼠标划上去有tooltip。 ifndef ELIDEDLABELH define ELIDEDLABELH include <QtWidgets/QFrame> include <QtCore/QRect> include <QtGui/QResizeEvent> inc...
你必须知道的28个HTML5特征、窍门和技术
Published: at 04:25 AM前端的发展如此之迅猛,一不留神,大侠你可能就会被远远地甩在后面了。如果你不想被HTML5的改变/更新搅得不知所措的话,可以把本文的内容作为必须了解的热身课程。 1. 新的Doctype > //zxx”doctype”中文意思指“文档类型” 仍在使用麻烦的,不可能记得住的XHTML文档类型...
swift UITableView cell自适应高度
Published: at 11:56 AMios8支持: override func viewDidLoad() { super.viewDidLoad() self.tableView.estimatedRowHeight = 100 self.tableView.rowHeight = UITableViewAutomaticDimension } func tableView(tableView UITable...
swift UILabel不显示html标签
Published: at 11:55 AM带html标签的文本srcText var attrStr = NSAttributedString(data srcText.dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion true), options NSDocumentTypeDocumentAttribute NSHTMLTextDocumentType, documentAttributes nil, error n...