网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
07月21日漏签0天
qt吧 关注:49,977贴子:160,261
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 3回复贴,共1页
<<返回qt吧
>0< 加载中...

求助,提示没有成员函数,和提示未定义标志符

  • 只看楼主
  • 收藏

  • 回复
  • 朝日所以闻01
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
代码如下,是抄写的《Qt学习之路》的代码,我的环境是QT+VS
错误:没有程序变量backwardCheckBox、findButton
没有成员enableFindButton
代码:
#include <qttest1.h>
#include <QtWidgets/QDialog>
#include<QtGui>
#include "ui_qttest1.h"
#include <QGridLayout>
QTtest1::QTtest1(QWidget *parent)
: QDialog(parent)
{
label = new QLabel(tr("Find &what:"));
lineEdit = new QLineEdit;
label->setBuddy(lineEdit);
caseCheckBox = new QCheckBox(tr("Match &case"));
backwardCheckBox = new QCheckBox(tr("Search &backford"));
findButton = new QPushButton(tr("&Find"));
findButotn->setDefault(true);
findButton->setEnabled(false);
closeButton = new QPushButton(tr("Close"));
connect(lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(enableFindButton(const QString&)));
connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
QHBoxLayout *topLeftLayout = new QHBoxLayout;
topLeftLayout->addWidget(label);
topLeftLayout->addWidget(lineEdit);
QVBoxLayout *leftLayout = new QVBoxLayout;
leftLayout->addLayout(topLeftLayout);
leftLayout->addWidget(caseCheckBox);
leftLayout->addWidget(backwardCheckBox);
QVBoxLayout *rightLayout = new QVBoxLayout;
rightLayout->addWidget(findButton);
rightLayout->addWidget(closeButton);
rightLayout->addStretch;
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addLayout(leftLayout);
mainLayout->addLayout(rightLayout);
setLayout(mainLayout);
setWindowTitle(tr("Find"));
setFixedHeight(sizeHint.height());
}
QTtest1::~QTtest1()
{
}
void QTtest1::findClicked()
{
QString text = lineEdit->text();
Qt::CaseSensitivity cs = caseCheckBox->isChecked() ? Qt::CaseInsensitive : Qt::CaseSensitive;
if (backwardCheckBox->isChecked())
{
emit findPrevious(text,cs);
}
else{
emit findNext(text,cs);
}
}
void QTtest1::enableFindButton(const QString &text)
{
findButton->setEnabled(!text.isEmpty());
}
求大神指教


  • 朝日所以闻01
  • 中级粉丝
    2
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
新手,还望大神们多指教


2026-07-21 08:32:11
广告
不感兴趣
开通SVIP免广告
  • eilaes
  • 活跃吧友
    5
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
应该是头文件那里没有定义好变量,或者一些头文件没有inlude吧,我猜!


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 3回复贴,共1页
<<返回qt吧
分享到:
©2026 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示