Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error when using QT Creator.

Error when using QT Creator.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amre9480
    wrote on last edited by
    #1

    I have a dictionary class for which I have written this header.

    @#ifndef DICTIONARY_H
    #define DICTIONARY_H
    #include <QApplication>
    #include <QString>
    #include <QLabel>
    #include <QWidget>
    #include <QDebug>
    #include <QTextStream>
    #include <QFile>
    #include <QString>
    #include <QStringList>
    #include <QTextStream>
    #include <QTextEdit>
    #include <QDir>
    #include <QHash>
    #include <QMultiMap>
    #include "qstd.h"

    using namespace std;

    class Dictionary
    {
    private:

    static QTextStream screenOut;
    QFile dictFile;
    QFile dataFile;
    QString data;
    QString dataP;
    QStringList dictList;
    QStringList dataList;

    QStringList spellCheckList[];

    QHash<QString, int> dictHash;
    QHash<QString, int> dataHash;
    QHash<QString, int> missSpellHash;
    QMultiMap<int, QString> spellCorrect;
    QMultiMap<int, QString> spellWrong;

    bool isMissSpell(QString word);

    public:
    // Constructor
    Dictionary();

    //Constructor 2
    

    Dictionary(QString filename);

    //Destructor
    ~Dictionary();

    //Function to open text file
    bool open(QString filename);

    bool isAvailable(QString word);

    void spellCheck(QString &message, QString filename);

    void wordCount(int iMost, QString &mostCorrect, QString &mostWrong);

    void setDict(string filename);
    

    };
    #endif@

    I also have this header for my gui main window

    @#ifndef MYDICTIONARYWINDOW_H
    #define MYDICTIONARYWINDOW_H

    #include <QMainWindow>
    #include "src/Dictionary.h"
    #include <string>

    using namespace std;

    namespace Ui {
    class myDictionaryWindow;
    }

    class myDictionaryWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit myDictionaryWindow(QWidget *parent = 0);
    ~myDictionaryWindow();

    public slots:

    void openDictionary(QString filename);
    

    private:
    Ui::myDictionaryWindow *ui;
    Dictionary myDict;
    };

    #endif // MYDICTIONARYWINDOW_H@

    and also my window cpp code:

    @#include "mydictionarywindow.h"
    #include "ui_mydictionarywindow.h"

    myDictionaryWindow::myDictionaryWindow(QWidget parent) :
    QMainWindow(parent),
    ui(new Ui::myDictionaryWindow)
    {
    ui->setupUi(this);
    Dictionary myDict();
    myDict.setDict("American");
    /
    myDict(ui->comboBox->currentText());
    QTextStream QOut(stdout);
    QOut << ui->comboBox->currentText();*/
    //cout << ui->comboBox->currentText();

    }

    myDictionaryWindow::~myDictionaryWindow()
    {
    delete ui;
    }

    void myDictionaryWindow::openDictionary(QString filename){
    myDict.open("American");

    }
    @

    I am getting an error however when trying to do myDict.open("American"):
    request for member 'setDict' in 'myDict', which is of non-class type 'Dictionary'

    I still get this error if I declare myDict like this: Dictionary myDict(); or Dictionary myDict("American");

    1 Reply Last reply
    0
    • A Offline
      A Offline
      amre9480
      wrote on last edited by
      #2

      Actually scratch that, I just realized the stupid mistake I made.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved