Skip to content
Snippets Groups Projects
Commit 85f96ce6 authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Fix section headers and model

This also changes headers to make section collapsible.

The model wasn't actually returning anything for some of it roles, so
sections didn't work...
parent 5e01a5b1
No related branches found
No related tags found
No related merge requests found
.exrc 0 → 100644
:set expandtab
:set tabstop=4
:retab
:set shiftwidth=4
let g:ale_cpp_clang_options = '-std=c++14 -Wall -I .'
let g:ale_cpp_gcc_options = '-std=c++14 -Wall -I .'
let g:ale_cpp_cppcheck_options = '--std=c++14 --enable=style -I .'
let g:ale_cpp_clangtidy_options = '-I . -x c++'
let g:ale_cpp_cpplint_options = '-I .'
"\ 'cpp': ['g++', 'cppcheck', 'cpplint', 'clang', 'clangtidy'],
let g:ale_linters = {
\ 'cpp': [ 'g++', 'cppcheck', 'cpplint', 'clang'],
\}
"let g:ale_cpp_clang_options = '-I '.expand('<sfile>:p:h')
"let g:ale_cpp_gcc_options = '-I '.expand('<sfile>:p:h')
"let g:ale_cpp_cppcheck_options = '-I '.expand('<sfile>:p:h')
"let g:ale_cpp_clangtidy_options = '-I '.expand('<sfile>:p:h')
"let g:ale_cpp_cpplint_options = '-I '.expand('<sfile>:p:h')
"echo expand("%:pwd")
"echo expand('<sfile>:p:h')
......@@ -5,3 +5,4 @@ harbour-matrix.pro.user
*.autosave
RPMS
documentation.list
*.swp
......@@ -16,25 +16,12 @@ Page {
}
}
}
Component {
id: sectionHeading
SectionHeader {
color: Theme.highlightColor
text: section
font.bold: true
font.pixelSize: Theme.fontSizeLarge
}
}
SilicaListView {
id: roomView
anchors.fill: parent
width: mainPage.width
contentHeight: mainPage.height
spacing: Theme.paddingLarge
contentWidth: mainPage.width
//spacing: Theme.paddingLarge
ScrollDecorator { flickable: roomView }
......@@ -58,11 +45,16 @@ Page {
}
model: rooms
signal sectionClicked(string name)
delegate: ListItem {
id: roomItem
menu: roomContextMenu
contentHeight: mainRow.height + Theme.paddingSmall
property bool collapsed: false
visible: !collapsed
contentHeight: collapsed ? 0 : (mainRow.height + Theme.paddingSmall)
contentWidth: parent.width
Row {
......@@ -90,7 +82,7 @@ Page {
Column {
width: mainRow.width - unreadMessages.width
- roomImageContainer.width - 3* Theme.paddingMedium
- roomImageContainer.width - 3* Theme.paddingMedium
Label {
id: roomName
text: model.roomName
......@@ -127,10 +119,22 @@ Page {
}
}
}
Connections {
target: roomItem.ListView.view
onSectionClicked: if (roomItem.ListView.section === name)
collapsed = !collapsed
}
}
section.property: "tag"
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
section.delegate: ExpandingSection {
title: section
onExpandedChanged: {
roomView.sectionClicked(section)
}
}
}
}
......@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
c.name = "RoomC";
rooms.addRoom(c);
Room i;
i.tag = "group";
i.tag = "invite";
i.lastMessage = "Hey, Nico hier!";
i.unreadNotifications = 3;
i.name = "Example invite";
......
......@@ -55,9 +55,9 @@ QVariant RoomModel::data(const QModelIndex &index, int role) const {
case LastMessageRole:
return QString::fromStdString(room.lastMessage);
case RoomPictureRole:
QString::fromStdString(room.picture);
return QString::fromStdString(room.picture);
case TagRole:
QString::fromStdString(room.tag);
return QString::fromStdString(room.tag);
default:
return QVariant();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment