[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: FYI: New calendar project (uses C++14 and C++17).
From:       Ivan Čukić <ivan.cukic () kde ! org>
Date:       2017-01-02 21:09:11
Message-ID: CAAWhJrz9xF28+_gCpozN18mk96Vo1FUZEgDygpbxUqriMuCr4w () mail ! gmail ! com
[Download RAW message or body]

Look ok to me. I hate Qt data models, so I'm not the best person to
comment on them.

As for the date stuff, you can check out the boost library (used in
Eric's talk) - I guess you would have less things to reimplement
yourself.

Cheers,
Ivan

On Mon, Jan 2, 2017 at 11:21 AM, Mark Gaiser <markg85@gmail.com> wrote:
> On Mon, Jan 2, 2017 at 10:46 AM, Ivan Čukić <ivan.cukic@kde.org> wrote:
>>
>> Hi Mark,
>>
>> An alternative to Niebler's range-v3 and cppitertools you might want
>> to try is boost.range (it is a part of the default boost package, I
>> don't know whether it has everything you'd need for this).
>>
>> I haven't seen where you used struct-bindings - the code compiles fine
>> with gcc -std=c++14.
>>
>> Cool you've started playing with things like these :)
>>
>> Cheers,
>> Ivan
>
>
> Hi Ivan,
>
> You're right, i'm not using structured bindings anymore.
> I didn't want to drop them, but i simplified my code before pushing it to
> github ;)
>
> Before my initial commit i had a vector of days for each month. While
> iterating through months i also needed to know the number of days till that
> point so i used a zip iterator like this
>
> for (auto&& [daysThusFar, month] : iter::zip(...))
> {
>
> }
>
> But i simplified that to use an algorithm for figuring out how many days are
> in any given month and just increment a counter for the days thus far. That
> made the zip redundant and with that the (only use of) structured bindings
> as well.
> Now it's just C++14 or perhaps even 11. My code looks 11, but the
> iter::range or iter::chunked iterators might require it to be C++14.
> Even then i play with "new" C++ features ;)
>
> Btw, do take a look at the model [1] I've made if you like.
> The model is derived from "QAbstractTableModel" which makes me a bit unsure
> if it would work in QML. Since QML seems to have a requirement for it's
> views to have the models be flat list models, not table models. But perhaps
> it's working just fine these days. I don't know, haven't tried it.
> The only thing the model misses is weeknumbers. Those can be calculated with
> a single std::tm instance (which i have in updateModel(...)) but i haven't
> implemented that yet.
>
> Cheers,
> Mark
>
> [1]
> https://github.com/markg85/cansole_calendar/blob/master/Qt/models/fixedmonthmodel.cpp



-- 
KDE, ivan.cukic@kde.org, http://cukic.co/
gpg key fingerprint: 292F 9B5C 5A1B 2A2F 9CF3  45DF C9C5 77AF 0A37 240A
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic