#ifndef TITLE_H
#define TITLE_H

#include <QHBoxLayout>
#include <QWidget>
#include <QPushButton>
#include <QLabel>
#include <QMenu>
#include "menumodule.h"
// sdk 搜索框
#include "ksearchlineedit.h"
#include "view/search/titlesearchcityview.h"
using namespace kdk;
class title : public QWidget
{
    Q_OBJECT
public:
    explicit title(QWidget *parent = nullptr);
    QPushButton *btnMaximum;
    menuModule *g_menu = nullptr;
    KSearchLineEdit *m_searchLineEdit;
    int getSearchLinePositionX();
    int getSearchLinePositionY();

protected:
    bool eventFilter(QObject *watch, QEvent *e) override;
    void keyPressEvent(QKeyEvent *event);
private:
    QHBoxLayout *m_titleLayout;
    QPushButton *logoBtn;
    QLabel *m_label;
    QPushButton *m_menuButton;
    QMenu *m_mainMenu;
    QPushButton *btnMinimize;
    QPushButton *btnCancel;
    // sdk 搜索输入框
    //KSearchLineEdit *m_searchLineEdit;

    void initConnection();
    void initLayout();
    void initQss();
    void sendSearchInput();
    QString m_searchText;
public slots:
    void slotSearchLineEditClear();
    void slotChangeLineEditStyle();
    void slotChangeHScreenMode();   // 平板横屏
    void slotChangeVScreenMode();   // 平板竖屏
    void slotChangePCMode();   // 平板竖屏
signals:
    void recovery();  //处理主界面最大化和还原
    void setMenuModuleAllowLocationYes();
    void sigTitleSearchCity();
    void sigChangeCityFromSearch();
    void sigLineEditGetFocus();
};

#endif // TITLE_H
