• Как исправить ошибку с созданием "main.moc"?

    @TRNER Автор вопроса
    devalone,
    *.pro:
    QT       += core gui network
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = untitled2
    TEMPLATE = app
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which has been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    
    SOURCES += \
            main.cpp \
            mainwindow.cpp
    
    HEADERS += \
            mainwindow.h
    
    FORMS += \
            mainwindow.ui

    mainwindow.h
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    #include <QtNetwork/QNetworkAccessManager>
    
    namespace Ui {
    class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();
    
    private slots:
        void MarketCurr(QNetworkReply *reply);
        void GetCurr(QNetworkReply *reply);
    
    private:
        Ui::MainWindow *ui;
        QNetworkAccessManager *networkManager;
    };
    
    #endif // MAINWINDOW_H

    main.cpp
    #include "mainwindow.h"
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
    
        return a.exec();
    }

    mainwindow.cpp
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    #include <QJsonDocument>
    #include <QJsonObject>
    #include <QJsonArray>
    #include <QUrlQuery>
    #include <QtNetwork/QNetworkReply>
    #include <QUrl>
    #include <QDebug>
    #include <QList>
    #include <QListWidget>
    #include <QtGui>
    
    QListWidgetItem* item;
    
    class ListController : public QObject {
        Q_OBJECT
    public slots:
        void onListDoubleClicked(const QModelIndex& index)
        {
            if(!index.isValid())
                return;
    
            if(QListWidget* listWgt = dynamic_cast<QListWidget*>(sender()))
            {
                if(QListWidgetItem* item = listWgt->takeItem(index.row()))
                {
                    delete item;
                }
            }
        }
    };
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
        networkManager = new QNetworkAccessManager();
        //connect(networkManager, &QNetworkAccessManager::finished, this, &MainWindow::MarketCurr);
        //networkManager->get(QNetworkRequest(QUrl("https://bittrex.com/api/v1.1/public/getmarkets")));
        connect(networkManager, &QNetworkAccessManager::finished, this, &MainWindow::GetCurr);
        networkManager->get(QNetworkRequest(QUrl("https://bittrex.com/api/v1.1/public/getmarketsummaries")));
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::GetCurr(QNetworkReply *reply)
    {
        if(!reply->error()){
    
            QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
    
            QJsonObject root = document.object();
    
            QJsonValue jv = root.value("result");
            if(jv.isArray()){
                QJsonArray ja = jv.toArray();
                for(int i = 0; i < ja.count(); i++){
                    QJsonObject subtree = ja.at(i).toObject();
    
                    item = new QListWidgetItem(subtree.value("MarketName").toString() + " (High: " + QString::number(subtree.value("High").toDouble()) + "; Low: " + QString::number(subtree.value("Low").toDouble()) + ")");
                    ui->listWidget->addItem(item);
                 }
            }
        }
        ListController LC;
        connect(ui->listWidget, SIGNAL(doubleClicked(QModelIndex)), &LC, SLOT(onListDoubleClicked(QModelIndex)));
    
        reply->deleteLater();
    }
    
    void MainWindow::MarketCurr(QNetworkReply *reply)
    {
        if(!reply->error()){
    
            QJsonDocument document = QJsonDocument::fromJson(reply->readAll());
    
            QJsonObject root = document.object();
            //ui->textEdit->append(root.keys().at(0) + ": " + root.value(root.keys().at(0)).toString());
    
            QJsonValue jv = root.value("result");
            if(jv.isArray()){
                QJsonArray ja = jv.toArray();
                for(int i = 0; i < ja.count(); i++){
                    QJsonObject subtree = ja.at(i).toObject();
                    //QString("%1").arg(subtree.value("MinTradeSize").toDouble())
                    //ui->textEdit->append(subtree.value("MarketName").toString()); QListWidgetItem(subtree.value("MarketName").toString()
                    //ui->textEdit->append(QString::number(root.value("MinTradeSize").toInt()));
    
                    item = new QListWidgetItem(subtree.value("MarketName").toString());
                    ui->listWidget->addItem(item);
                }
            }
        }
        reply->deleteLater();
    }
    
    #include "main.moc"
  • Как избежать конфликта bootstrap 3 и One Page Scroll?

    @TRNER Автор вопроса
    Сергей: Вот мой проект(он весь хромой, только не смейтесь) ) https://yadi.sk/d/4kmHlCc33ETPaU
  • Как избежать конфликта bootstrap 3 и One Page Scroll?

    @TRNER Автор вопроса
    Виктор Янышев: Если я вас правильно понял, то нет. Навигационное меню на сайте "прибито" к низу страницы, и при любом положении на сайте она будет зафиксированна в самом низу. Но когда я начинаю использовать One Page Scroll, то навигационное меню зафиксировано лишь внизу первой секции(т.н. "экрана"), а у остальных секций просто отсутствует.